import math def makeprime(k) : prime = [2,3,5,7,11] for i in range(13, k + 1, 2) : if (i % 3 == 0 or i % 5 == 0 or i % 7 == 0 or i % 11 == 0) : continue limit = int(math.sqrt(i)) + 1 isprime = False for x in prime : if (x > limit) : isprime = True break if (i % x == 0) : break if (isprime) : prime.append(i) return prime k = int(input()) prime = makeprime(k) i_r = 1 i_q = 3 cnt = 0 last_prime = prime[-1] limit_r = math.sqrt(2 + k) while (prime[i_r] <= limit_r) : R = prime[i_r] ** 2 while (True) : Q = 2 + prime[i_q] if (R == Q) : cnt += 1 break elif (Q > R or prime[i_q] == last_prime) : break i_q += 1 i_r += 1 print(cnt * 2 + 1 if k > 1 else 0)