// #define _GLIBCXX_DEBUG #include #include #define rep(i, n) for (long long i = 0; i < (n); i++) #define rep1(i, n) for(long long i = 1; i <= (n); i++) #define all(v) v.begin(),v.end() #define decimal(n) cout << fixed << setprecision(n); using namespace std; using namespace atcoder; using ll = long long; using vl = vector; using P = pair; using vvl = vector; using vc = vector; using vvc = vector; using mint = modint998244353; // using mint = modint1000000007; const ll MOD = 998244353; const ll MAX = 2000100; const ll inf = 3e18; const long double pi = acos(-1); templatebool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } templatebool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } ll lcm(ll a,ll b){ return (a*b) / gcd(a,b); } int main(){ ll n; cin >> n; set s; for(ll i=1; i <= 200000; i++){ s.insert(i * i); } ll ans = 0; for(ll i = 1; i <= n; i++){ if(s.count((n - i) * (n + i))) ++ans; } cout << ans << endl; }