#include using namespace std; using ll = long long int; using ld = long double; const ll MAX = 5000000000000000000; const ld PI = 3.14159265358979; const ll MOD = 0;//2024948111; random_device rd; mt19937 mt(rd()); ld dotorad(ld K){return PI * K / 180.0;} ld radtodo(ld K){return K * 180.0 / PI;} int main(){ ll N,ans = 0; cin >> N; for(ll i = 1;i <= N;i++){ ll p = sqrtl(N * N - i * i); for(ll j = max(1LL,p - 10);j <= p + 10;j++){ if(i * i + j * j == N * N) ans++; } } cout << ans << endl; }