import math N=int(input()) def searchPrimeNum(N): # 素数列挙 こっち使う max = int(math.sqrt(N)) searchList = [i for i in range(2,N+1)] primeNum = [] while searchList[0] <= max: primeNum.append(searchList[0]) tmp = searchList[0] searchList = [i for i in searchList if i % tmp != 0] primeNum.extend(searchList) return primeNum table=searchPrimeNum(N) cnt=0 for r in table: p=r**2-2 if p in table: if p!=2: cnt+=2 else: cnt+=1 print(cnt)