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