#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; long long ans = 0; long long x = 1; long long y = n; while (true) { if (x >= n || y < 1) break; if (x*x+y*y == n*n) { ans++; x++; y--; } else if (x*x+y*y < n*n) { x++; } else y--; } cout << ans << endl; }