#ifdef _DEBUG #include #define debug(x) std::cout << #x << ": " << x << std::endl #else #include #include //#pragma GCC target("arch=skylake-avx512") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define debug(x) #endif using namespace std; using namespace atcoder; using ll = long long; #define rep(...) _overloadrep(__VA_ARGS__, _rep4, _rep3, _rep2)(__VA_ARGS__) #define _overloadrep(_1, _2, _3, _4, _repn, ...) _repn #define _rep2(i, n) _rep4(i, 0, n, 1) #define _rep3(i, a, b) _rep4(i, a, b, 1) #define _rep4(i, a, b, s) for (auto i = (a); i < (b); i += (s)) #define repr(i, a, b) for (auto i = (b)-1; i >= (a); --i) #define all(x) (x).begin(), (x).end() #define siz(x) int((x).size()) template inline bool chmax(T1 &a, const T2 &b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T1 &a, const T2 &b) { if (a > b) { a = b; return true; } return false; } constexpr char enl = '\n'; constexpr int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; constexpr int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; constexpr long double eps = 1e-10; constexpr int INF = 1010000000; // 1e9 constexpr ll llINF = 3010000000000000000LL; // 3e18 constexpr ll MOD = 1000000007LL; //constexpr ll MOD = 998244353LL; using mint = static_modint; void Main([[maybe_unused]] int testcase_i) { ll n; cin >> n; n *= n; unordered_set s; for (ll i = 1; i * i < n; ++i) { s.insert(i*i); } ll ans = 0; for (auto x : s) if (s.count(n-x)) ++ans; cout << ans << enl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int t = 1; //cin >> t; rep(i, t) Main(i); }