#include using namespace std; typedef long long ll; const int INF = (1<<30)-1; const ll LINF = (1LL<<60)-1; #define rep(i, n) for (int i = 0; i < n; i++) #define sz(a) (int)(a.size()) template bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;} template bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;} ll sqr(ll x){ ll r=sqrt(x)-1; while((r+1)*(r+1)<=x)r++; return r; } //コーナーケースに気をつけろ! int main() { ll n, ans = 0; cin >> n; for (ll x = 1; x < n; x++) { ll y = sqr(n*n-x*x); if (y*y + x*x == n*n) ans++; } cout << ans << endl; return 0; } //小数点精度 //cout << fixed << std::setprecision(15) << y << endl;