#include #include #define pub push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i, n) rep2(i, 0, n) #define rep2(i, m, n) for (ll i = m; i < (n); i++) #define per(i, b) per2(i, 0, b) #define per2(i, a, b) for (ll i = int(b) - 1; i >= int(a); i--) #define ALL(c) (c).begin(), (c).end() using namespace std; using namespace atcoder; using ll = long long; using Pll = pair; using mint = modint998244353; using mint2 = modint1000000007; constexpr long long INF = (1LL << 60); template bool chmax(T& a, const T& b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template bool chmin(T& a, const T& b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } template T square(T x) { return x * x; } std::string zfill(int n, const int width) { std::stringstream ss; ss << std::setw(width) << std::setfill('0') << n; return ss.str(); } bool IsPrime(int num) { if (num < 2) return false; else if (num == 2) return true; else if (num % 2 == 0) return false; // 偶数はあらかじめ除く double sqrtNum = sqrt(num); for (int i = 3; i <= sqrtNum; i += 2) { if (num % i == 0) { // 素数ではない return false; } } // 素数である return true; } template std::map factorize(T n) { std::map factor_map; for (T i = 2; i * i <= n; i++) { while (!(n % i)) { factor_map[i]++; n /= i; } } if (n > 1) factor_map[n]++; return factor_map; } /* divisor(n) 入力:整数 n 出力:nのすべての約数 計算量:O(√n) */ vector divisor(long long n) { vector ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(ret.begin(), ret.end()); // 昇順に並べる return ret; } int main(void) { ll N; cin >> N; ll ans = 0; rep(a, 10) { rep(b, 10) { if (a == b) { continue; } ll high = 1000000001; ll low = 0; while (high > low) { ll mid = (high + low) / 2; if (mid * mid - a * N * mid - N * b - 1 < 0) { low = mid; } else { high = mid; } if (high == low + 1) { break;} } ll p = max((ll)2, max(a + 1, b + 1)); ans += max((ll)0, low - p + 1); } } cout << ans << endl; }