#include #include using namespace std; int main() { int n; cin >> n; long long res = 0; for (int x = 1; x < n; x++) { long long y2 = (long long)n * n - x * x; map y; for (int i = 2; i < n; i++) { while(y2 % i == 0) { y2 /= i; y[i]++; } if (y2 == 1) break; if (i == n - 1) y[y2]++; } bool b = true; for (auto p : y) { if (p.second % 2 == 1) b = false; } if (b) res++; } cout << res << endl; return 0; }