#include using namespace std; typedef long long LL; int main() { LL N,N2; cin >> N; N2 = N * N; LL nums = 0; for (int x = 1; x <= N; x++) { for (int y = 1; y <= N; y++) { if (x*x + y * y == N2) { nums++; } } } cout << nums << endl; return 0; }