from collections import defaultdict def eratosthenes(N): P = [] d = defaultdict(int) for p in range(2,N+1): if d[p] == 1: continue P.append(p) for q in range(1,N//p+1): d[p*q] = 1 return P d = defaultdict(int) N = int(input()) P = eratosthenes(300000) Q = [2] S = [] ans = 0 for i in range(2,len(P)): c = P[i] if c > N: break for p in Q: q = p + P[i-1] d[q] += 1 Q.append(P[i-1]) for p in P: q = p - c ans += d[q] print(ans)