#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897;
ostream& operator<<(ostream& oout, pair<long long, long long> p) {
  oout << "(" << p.first << ", " << p.second << ")";
  return oout;
}
istream& operator>>(istream& iin, pair<long long, long long>& p) {
  iin >> p.first;
  iin >> p.second;
  return iin;
}
template <typename T>
istream& operator>>(istream& iin, vector<T>& a) {
  for (T& i : a) {
    cin >> i;
  }
  return iin;
}
template <typename T>
ostream& operator<<(ostream& oout, vector<T>& a) {
  for (T& i : a) {
    cout << i << " ";
  }
  return oout;
}
template <typename T>
T min(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = min(ans, i);
  }
  return ans;
}
template <typename T>
T max(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = max(ans, i);
  }
  return ans;
}
template <typename T>
bool operator==(pair<T, T> a, pair<T, T> b) {
  return a.first == b.first and a.second == b.second;
}
const long long MOD = 1000000007;
inline long long add_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod + (b >= 0 ? b : b + mod) % mod) % mod;
}
inline long long sub_mod(long long a, long long b, const long long mod = MOD) {
  long long result = ((a >= 0 ?: a + mod) % mod - (b >= 0 ? b : b + mod) % mod);
  return (result >= 0 ? result : result + mod) % mod;
}
inline long long mult_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod * (b >= 0 ? b : b + mod) % mod) % mod;
}
long long fast_expo(long long x, long long y, const long long mod = MOD) {
  long long ans = 1;
  while (y > 0) {
    if (y % 2 == 1) ans = mult_mod(x, ans, mod);
    x = mult_mod(x, x, mod);
    y /= 2;
  }
  return ans;
}
inline long long div_mod(long long a, long long b, const long long mod = MOD) {
  return mult_mod(a, fast_expo(b, mod - 2, mod), mod);
}
long long mod_square(long long u, long long v) { return (u * u + v * v); }
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void solve() {
  long long n;
  cin >> n;
  long long cnt = 0;
  for (long long u = 1; u < n + 1; u++) {
    for (long long v = u; v < n + 1; v++) {
      if (v * v + u * u > n * n) {
        break;
      } else if (isPerfectSquare((long double)(u * u + v * v))) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  long long num_test_cases = 1;
  while (num_test_cases--) {
    solve();
  }
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

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 = 3.1415926535897;
ostream& operator<<(ostream& oout, pair<long long, long long> p) {
  oout << "(" << p.first << ", " << p.second << ")";
  return oout;
}
istream& operator>>(istream& iin, pair<long long, long long>& p) {
  iin >> p.first;
  iin >> p.second;
  return iin;
}
template <typename T>
istream& operator>>(istream& iin, vector<T>& a) {
  for (T& i : a) {
    cin >> i;
  }
  return iin;
}
template <typename T>
ostream& operator<<(ostream& oout, vector<T>& a) {
  for (T& i : a) {
    cout << i << " ";
  }
  return oout;
}
template <typename T>
T min(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = min(ans, i);
  }
  return ans;
}
template <typename T>
T max(vector<T> a) {
  long long ans = a[0];
  for (auto i : a) {
    ans = max(ans, i);
  }
  return ans;
}
template <typename T>
bool operator==(pair<T, T> a, pair<T, T> b) {
  return a.first == b.first and a.second == b.second;
}
const long long MOD = 1000000007;
inline long long add_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod + (b >= 0 ? b : b + mod) % mod) % mod;
}
inline long long sub_mod(long long a, long long b, const long long mod = MOD) {
  long long result = ((a >= 0 ?: a + mod) % mod - (b >= 0 ? b : b + mod) % mod);
  return (result >= 0 ? result : result + mod) % mod;
}
inline long long mult_mod(long long a, long long b, const long long mod = MOD) {
  return ((a >= 0 ? a : a + mod) % mod * (b >= 0 ? b : b + mod) % mod) % mod;
}
long long fast_expo(long long x, long long y, const long long mod = MOD) {
  long long ans = 1;
  while (y > 0) {
    if (y % 2 == 1) ans = mult_mod(x, ans, mod);
    x = mult_mod(x, x, mod);
    y /= 2;
  }
  return ans;
}
inline long long div_mod(long long a, long long b, const long long mod = MOD) {
  return mult_mod(a, fast_expo(b, mod - 2, mod), mod);
}
long long mod_square(long long u, long long v) { return (u * u + v * v); }
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void solve() {
  long long n;
  cin >> n;
  long long cnt = 0;
  for (long long u = 1; u < n + 1; u++) {
    for (long long v = u; v < n + 1; v++) {
      if (v * v + u * u > n * n) {
        break;
      } else if (isPerfectSquare((long double)(u * u + v * v))) {
        cnt++;
      }
    }
  }
  cout << cnt;
  return;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  long long num_test_cases = 1;
  while (num_test_cases--) {
    solve();
  }
  return 0;
}

```