#include using namespace std; using ll = long long; // -------------------------------------------------------- #define FOR(i,l,r) for (ll i = (l); i < (r); ++i) #define REP(i,n) FOR(i,0,n) // -------------------------------------------------------- // 平方数判定: O(log n) bool is_square_number(ll n) { ll l = 0, r = 1e9; while (r - l > 1) { ll m = (l + r) / 2; (n <= m*m ? r : l) = m; } return r*r == n; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); ll N; cin >> N; ll ans = 0; FOR(x,1,N) { ll y2 = N*N - x*x; if (is_square_number(y2)) ans++; } cout << ans << endl; return 0; } // Verify: https://yukicoder.me/problems/no/1593