def sieve_of_eratosthenes(n): candidate = list(range(2, n+1)) prime = [] limit = n**0.5 + 1 while True: p = candidate[0] if limit <= p: prime.extend(candidate) break prime.append(p) candidate = [i for i in candidate if i % p != 0] return prime N=int(input()) prime = sieve_of_eratosthenes(N) s=0 prime2=[i for i in prime if i<=800] for i in range(len(prime2)): if (prime2[i]**2)-2 in prime: s+=1 print(s*2-1)