1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
//#include <cassert>

const int inf = 2e9;
const long long ill = 4e18;
const long long mod = 998244353;
const long double eps = 1e-6;

#define pii pair<int, int>
#define tui tuple<int, int, ll>
typedef long long ll;
typedef long double ld;

using namespace std;

void solve() {
	for (int file = 1; file <=1; file++) {
		/*string fn = to_string(file);
		ifstream cin(fn+".in");*/
		int n;
		cin >> n;
		vector<int> lol(n * n + 1);
		for (int i = n; i > 0; i--) {
			for (int j = 1; j < i; j++) {
				lol[i * i - j * j]++;
			}
		}
		int cnt = 0;
		for (int a = 1; a <= n; a++) {
			for (int b = 1; b <= a; b++) {
				int v = n * n - a * a - b * b;
				if (a*a+b*b <= n*n) {
					cnt+=lol[a*a+b*b];
					//cout << a << " " << b << ":" << lol[a * a + b * b]<<'\n';
				}
					
			}
		}
		/*ifstream ansin(fn + ".out");
		ll ans;
		ansin >> ans;*/
		cout << cnt << '\n';
		/*if (ans != res)
			cout << "ERROR at test " << file << ". answer:" << ans << '\n';*/
		
	}
	
}

signed main() {
	ios_base::sync_with_stdio(0);
	int t = 1;
	//cin >> t;
	while (t--)
		solve();


}