import math import bisect N = int(input()) def SoE(x): if x < 2: return [] l = [i for i in range(x + 1)] l[1] = 0 for i in l: if i > math.sqrt(x): break if i == 0: continue for j in range(2 * i , x + 1, i): l[j] = 0 return [i for i in l if i != 0] def index(a, x): i = bisect.bisect_left(a, x) if i != len(a) and a[i] == x: return 2 else: return 0 prime = SoE(N) ans = 0 for l_i in prime: a = pow(l_i,2) - 2 ans += index(prime,a) print(ans - 1)