N = int(input()) prime = [-1]*(N+1) L = [] for i in range(2, N+1): if prime[i] == 0: continue L.append(i) prime[i] = 1 for j in range(2*i, N+1, i): prime[j] = 0 ans = -1 for r in L: if r**2-2 > N: break if prime[r**2-2] == 1: ans += 2 print(max(0, ans))