#include using namespace std; int main(){ int64_t n; cin >> n; vector v(n, 1); set s; for(int64_t i = 1;i < n;i++){ v[i] = i * i; s.insert(v[i]); } int64_t root = n * n; int ans = 0; for(int i = 1;i < n;i++){ if(v[i] >= root) break; if(s.find(root - v[i]) != s.end()){ ans++; } } cout << ans << endl; }