// code by lynmisakura. wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

#define REP(i,N) for(int i = 0;i < N;i++)
using ll = long long;

int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  
  ll N;cin >> N;
  
  int ans = 0;

  for(ll x = 1;x * x < N*N;x++){
    ll y = sqrt(N*N - x*x);
    ans += (x*x + y*y == N*N);
  }

  cout << ans << '\n';

}