import math N = int(input()) if N == 1: print(0) else: prime = [] numberlist = [] for i in range(2, N+1): numberlist.append(i) while numberlist[0] <= int(math.sqrt(N)): now = numberlist.pop(0) prime.append(now) newnumberlist = [] for i in range(0, len(numberlist)): if numberlist[i]%now != 0: newnumberlist.append(numberlist[i]) numberlist = newnumberlist prime = prime + numberlist sqprime = [] for i in range(0, len(prime)): if prime[i]*prime[i] > 2*prime[-1]: break sqprime.append(prime[i]*prime[i]) cnt = 0 for i in range(0, len(sqprime)): if sqprime[i]-2 in prime: if i == 0: cnt += 1 else: cnt += 2 print(cnt)