#include using namespace std; using ll = long long; using ld = long double; using pint = pair; using pll = pair; int main(){ ll N; cin >> N; ll temp = N - 1, y = 1, ans = 0; N = N * N; for(ll x = temp; x > 0; x--){ while(x * x + y * y < N)y++; if(x * x + y * y == N)ans++; } cout << ans << endl; }