#include using namespace std; using ll = long long; ll F(ll N, ll a, ll b, ll mu) { return mu * mu - (N * a * mu) - N * b - 1; } int main () { ll N; cin >> N; ll ans = 0; for (ll a = 0; a < 10; a ++) { for (ll b = 0; b < 10; b ++) { if (a == b) { continue; } ll ok = N * a; ll ng = (ll)1e18; while (abs(ok - ng) > 1) { ll mu = (ok + ng) / 2; if (F(N, a, b, mu) < 0) { ok = mu; } else { ng = mu; } } ans += max(0ll, min(ok, (ll)1e9) - max({1ll, a, b})); } } cout << ans << endl; }