#include using namespace std; typedef long long ll; int main() { int n; cin>>n; bool isp[n+1]; fill(isp,isp+n+1,true); isp[0]=isp[1]=false; vector ps; for (int i=2;i<=n;i++) { if (isp[i]) { ps.push_back(i); for (int j=i+i;j<=n;j+=i) isp[j]=false; } } int ans=0; for (int r:ps) { if (r*r>2*n) break; for (int p:ps) { int q=r*r-p; if (q<0) break; if (isp[q]) ans++; } } cout<