#include using namespace std; using ll = long long; ll solve() { ll N; cin >> N; ll ans = 0, y = N; for ( int x = 1; x < N; x++ ) { while ( x*x + y*y > N*N ) y--; if ( x*x + y*y == N*N ) ans++; } return ans; } int main() { auto ans = solve(); cout << ans << "\n"; return 0; }