#include using namespace std; #define int long long int tbl[500010] = {}; vector so; set st; signed main(){ int n; cin >> n; for(int i = 2;i <= n;i++){ if(tbl[i] == 0){ so.push_back(i); st.insert(i); for(int j = i*2;j <= n;j+=i){ tbl[j] = 1; } } } int cnt = 0; for(int i = 0;i < so.size();i++){ int rr = so[i]*so[i]; if(rr > n) break; for(int j = 0;j < so.size();j++){ if(rr-so[j] < 2) break; if(st.find(rr-so[j]) != st.end()) cnt++; } } cout << cnt << endl; return 0; }