#include <bits/stdc++.h>
using namespace std;

int main()
{
  int64_t n;
  cin >> n;
  int64_t x = 1;
  int64_t y = 200000;
  int64_t ans = 0;
  while (n * n - x * x > 0) {
    while (n * n - x * x < y * y) {
      y--;
    }
    if (x * x + y * y == n * n) {
      ans++;
    }
    x++;
  }
  cout << ans << endl;
}