#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 200;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
inline int lowbit(int x) { return x & (-x); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void ex_gcd(long long a, long long b, long long &d, long long &x,
            long long &y) {
  if (!b) {
    d = a, x = 1, y = 0;
  } else {
    ex_gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
inline long long qpow(long long a, long long b, long long MOD = mod) {
  long long res = 1;
  a %= MOD;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
inline long long inv(long long x, long long p) { return qpow(x, p - 2, p); }
inline long long Jos(long long n, long long k, long long s = 1) {
  long long res = 0;
  for (int i = 1; i <= n + 1; ++i) res = (res + k) % i;
  return (res + s) % n;
}
inline long long read() {
  long long f = 1;
  long long x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * f;
}
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main() {
  long long m;
  scanf("%lld", &m);
  long long sum = 0;
  for (int i = 1; i <= m; ++i) {
    long long n = i;
    n = n * n;
    int now = 2;
    long long ans = 1;
    while (n != 1) {
      if (n % now != 0) {
        now++;
        continue;
      }
      int cnt = 0;
      while (n % now == 0) {
        n /= now;
        cnt++;
      }
      if (now % 2 == 0) {
        now++;
        continue;
      } else if (now % 4 == 1)
        ans *= (cnt + 1);
      else if (cnt % 2) {
        ans = 0;
        break;
      }
      now++;
    }
    sum += (ans - 1) / 2;
  }
  printf("%lld\n", sum);
  return 0;
}

### Prompt

Generate a Cpp solution to the following problem:

In mathematics, the Pythagorean theorem — is a relation in Euclidean geometry among the three sides of a right-angled triangle. In terms of areas, it states:

In any right-angled triangle, the area of the square whose side is the hypotenuse (the side opposite the right angle) is equal to the sum of the areas of the squares whose sides are the two legs (the two sides that meet at a right angle). 

The theorem can be written as an equation relating the lengths of the sides a, b and c, often called the Pythagorean equation:

a2 + b2 = c2

where c represents the length of the hypotenuse, and a and b represent the lengths of the other two sides.

<image>

Given n, your task is to count how many right-angled triangles with side-lengths a, b and c that satisfied an inequality 1 ≤ a ≤ b ≤ c ≤ n.

Input

The only line contains one integer n (1 ≤ n ≤ 104) as we mentioned above.

Output

Print a single integer — the answer to the problem.

Examples

Input

5


Output

1


Input

74


Output

35

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 200;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
inline int lowbit(int x) { return x & (-x); }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void ex_gcd(long long a, long long b, long long &d, long long &x,
            long long &y) {
  if (!b) {
    d = a, x = 1, y = 0;
  } else {
    ex_gcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
inline long long qpow(long long a, long long b, long long MOD = mod) {
  long long res = 1;
  a %= MOD;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
inline long long inv(long long x, long long p) { return qpow(x, p - 2, p); }
inline long long Jos(long long n, long long k, long long s = 1) {
  long long res = 0;
  for (int i = 1; i <= n + 1; ++i) res = (res + k) % i;
  return (res + s) % n;
}
inline long long read() {
  long long f = 1;
  long long x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * f;
}
int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main() {
  long long m;
  scanf("%lld", &m);
  long long sum = 0;
  for (int i = 1; i <= m; ++i) {
    long long n = i;
    n = n * n;
    int now = 2;
    long long ans = 1;
    while (n != 1) {
      if (n % now != 0) {
        now++;
        continue;
      }
      int cnt = 0;
      while (n % now == 0) {
        n /= now;
        cnt++;
      }
      if (now % 2 == 0) {
        now++;
        continue;
      } else if (now % 4 == 1)
        ans *= (cnt + 1);
      else if (cnt % 2) {
        ans = 0;
        break;
      }
      now++;
    }
    sum += (ans - 1) / 2;
  }
  printf("%lld\n", sum);
  return 0;
}

```