#include using ll = long long; using std::cin; using std::cout; using std::endl; std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count()); template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int inf = (int)1e9 + 7; const long long INF = 1LL << 60; void solve() { ll n; cin >> n; int cnt = 0; for (int x = 1; x < n; ++x) { ll y2 = n * n - 1LL * x * x; ll sq = std::sqrt(y2); for (int i = std::max(sq - 2, 1LL); i <= sq + 2; ++i) { if(1LL * i * i == y2) { cnt += 1; } } } cout << cnt << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int kkt = 1; // cin >> kkt; while(kkt--) solve(); return 0; }