#include using namespace std; long long n, m = 0; int main() { cin >> n; for (long long i = 1; i * i * 2 < n * n; i++) { long long j = (long long)sqrt(n * n - i * i); if (i * i + j * j == n * n) m += 2; } cout << m << endl; }