#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<ll,ll,ll>
using Graph = vector<vector<int>>;

ll mod = 1000000007;

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i=1;i*i<N*N;i++){
        ll j = N*N-i*i;
        ll s = sqrt(j);
        rep(k,2){
            if((s-1+k)*(s-1+k)==j) ans ++;
        }
    }
    cout << ans << endl;
}