#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 ans = 0; rep(i,1,N) rep(j,1,N) { double res = (double)i*i + j*j * 1.0; res = sqrt(res); if(res == N) ans++; if(res > N) break; } cout << ans << endl; }