#include // #include // #include using namespace std; // using namespace atcoder; // using bint = boost::multiprecision::cpp_int; using ll = long long; using ull = unsigned long long; using P = pair; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define MOD 1000000007 int main(){ ll n; cin >> n; int res = 0; for(ll x = 1;x < n;x++){ ll l = 0,r = n; while(r-l > 1){ ll mid = (l+r)/2; if(x*x + mid*mid >= n*n)r = mid; else l = mid; } if(x*x + r*r == n*n)res++; } cout << res << "\n"; return 0; }