N = int(input()) def seachPrimeNum(N): max = int(N**0.5) seachList = [i for i in range(2,N+1)] primeNum = [] while seachList[0] <= max: primeNum.append(seachList[0]) tmp = seachList[0] seachList = [i for i in seachList if i % tmp != 0] primeNum.extend(seachList) return primeNum PL = seachPrimeNum(N) PLS = set(PL) ans = 0 for r in PL: r2 = r * r if r2 > 2 * N: break for p in PL: if r2 - p in PLS: ans += 1 print(ans)