#include #include #define rep(i,n) for(int i = 0; i < n; i++) #define srep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),A.end() #define MOD 1000000007 using namespace std; using ll = long long; using P = pair; using Graph = vector>; int main(void){ ll n; cin >> n; ll cnt = 0; rep(x,n){ ll y = (ll)sqrt(1.0*n*n-1.0*(x+1)*(x+1)); if(y*y+(x+1)*(x+1) == n*n) cnt++; } cout << cnt-1; }