#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a%b); } vector >pythagorean_triple(long long ub) { vector >ret; for (long long m = 1; m * m <= ub; m++) { for (long long n = m + 1; m * m + n * n <= ub; n++) { if (m % 2 == n % 2) continue; if (gcd(m, n) > 1) continue; long long a = n * n - m * m; long long b = 2 * n * m; long long c = n * n + m * m; if (max({a, b, c}) <= ub) { ret.emplace_back(a, b, c); } } } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int L; cin >> L; long long ret = 0; for (auto &[a, b, c]: pythagorean_triple(L)) { if (4 * (a + b + c) <= L) { if (++ret == 1e6 + 3) ret = 0; } } cout << ret << endl; return 0; }