#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0);
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
unsigned long long int binpow(unsigned long long int b,
                              unsigned long long int n) {
  if (n == 0) return 1;
  if (n == 1) return b;
  if (n & 1)
    return binpow(b, n - 1) * b;
  else
    return binpow(b * b, n / 2);
}
long long int bigmod(long long int b, long long int n, long long int m) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long int x = bigmod(b, n / 2, m) % m;
    return (x * x) % m;
  } else
    return ((b % m) * bigmod(b, n - 1, m) % m) % m;
}
void start() {}
void solve() {
  long long int n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      long long int h = i * i + j * j;
      if (ceil(sqrt(h) == floor(sqrt(h)))) {
        long long int c = sqrt(h);
        if (c <= n) cnt++;
      }
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  start();
  solve();
  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 double pi = 2 * acos(0);
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
unsigned long long int binpow(unsigned long long int b,
                              unsigned long long int n) {
  if (n == 0) return 1;
  if (n == 1) return b;
  if (n & 1)
    return binpow(b, n - 1) * b;
  else
    return binpow(b * b, n / 2);
}
long long int bigmod(long long int b, long long int n, long long int m) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long int x = bigmod(b, n / 2, m) % m;
    return (x * x) % m;
  } else
    return ((b % m) * bigmod(b, n - 1, m) % m) % m;
}
void start() {}
void solve() {
  long long int n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      long long int h = i * i + j * j;
      if (ceil(sqrt(h) == floor(sqrt(h)))) {
        long long int c = sqrt(h);
        if (c <= n) cnt++;
      }
    }
  }
  cout << cnt << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  start();
  solve();
  return 0;
}

```