#include <bits/stdc++.h>

using namespace std;

int main(){
    int64_t n;
    cin >> n;

    int ans = 0;
    for (int64_t x = 1; x < n; x++){
        auto y2 = n * n - x * x;
        long double y2d = y2;
        int64_t y = sqrt(y2d);
        if (y * y == y2)
            ans++;
    }

    cout << ans << endl;
}