#include #include #include #include #include #include #include #include #include static const int MOD = 1000000007; using ll = long long; using uint = unsigned; using ull = unsigned long long; using namespace std; template constexpr T INF = ::numeric_limits::max() / 32 * 15 + 208; ull Isqrt(ull const &x){ ull ret = (ull)sqrtl(x); while(ret > 0 && ret*ret > x) --ret; while(x - ret*ret > 2*ret) ++ret; return ret; } int main() { ll n; cin >> n; int ans = 0; for (ll i = 1; i <= n; ++i) { ll p = Isqrt(n*n-i*i); if(p > 0 && p*p+i*i == n*n) ans++; } cout << ans << "\n"; return 0; }