#include <bits/stdc++.h>
using namespace std;

int msb (int i) {
  while (i >= 10) i /= 10;
  return i;
}

int main() {
  int n;
  cin >> n;
  int cnt[10][10] = {};
  for (int i = 1; i <= n; ++i) {
    cnt[msb(i)][i%10]++;
  }
  long long ans = 0;
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      ans += 1ll * cnt[i][j] * cnt[j][i];
    }
  }
  cout << ans << endl;
}