#include using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define RREP(i, n) for (int i = (int)(n); i >= 0; i--) #define rep(i, a, n) for (int i = (a); i < (int)(n); i++) #define rrep(i, a, n) for (int i = (a); i >= (int)(n); i--) #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() using ll = long long; using vi = vector; using vii = vector>; using P = pair; int main() { ll N; cin >> N; ll cnt = 0; rep(i,1,N) { ll x = i; ll y = sqrt(1LL * N*N - x*x); if( x*x+y*y == N*N ) cnt++; } cout << cnt << endl; return 0; }