Prime = [True for _ in range(2 * 10**6 + 2)] Prime[0] = Prime[1] = False for i in range(2, 2 * 10**6 + 2): if not Prime[i]: continue for j in range(2 * i, 2 * 10**6 + 2, i): Prime[j] = False l, r = map(int, input().split()) ans = 0 for i in range(l, r + 1): if Prime[i]: ans += 1 if i < r and Prime[2 * i + 1]: ans += 1 print(ans)