#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f, maxn = 100001;
int d(int x) { return (x - 1) % 9 + 1; }
int num(int n, int x) { return n / 9 + (n % 9 >= x ? 1 : 0); }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    long long ans = 0;
    for (int i = 1; i <= 9; i++)
      for (int j = 1; j <= 9; j++)
        ans += 1ll * num(n, i) * num(n, j) * num(n, d(i * j));
    for (int i = 1; i <= n; i++) ans -= n / i;
    printf("%I64d\n", ans);
  }
  return 0;
}
