#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const long long int INF = numeric_limits::max() / 4; const int inf = numeric_limits::max() / 4; const long long int MOD1000000007 = 1000000007; const long long int MOD998244353 = 998244353; const double MATH_PI = 3.1415926535897932; template inline void chmin(T1 &a, const T2 &b) { if (a > b) a = b; } template inline void chmax(T1 &a, const T2 &b) { if (a < b) a = b; } #define lint long long int #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() #define rep(i, n) for(int i=0;i<(int)(n);i++) #define VI vector #define VLL vector #define VC vector #define VB vector #define PI pair #define PLL pair #define VPI vector> #define VPLL vector> #define VVI vector> #define VVPI vecor>> #define VVPILL vector>> #define SUM(v) accumulate(ALL(v), 0LL) #define MIN(v) *min_element(ALL(v)) #define MAX(v) *max_element(ALL(v)) int main() { set st; for (lint i = 1; i <= 1000000; i++) { st.insert(i * i); } lint n; cin >> n; lint ans = 0; for (lint x = 1; x * x <= n * n; x++) { lint yy = n * n - x * x; if (st.count(yy)) ans++; } cout << ans << endl; return 0; }