#include <iostream>
using namespace std;

int f(int n) {
  while (n / 10) {
    n /= 10;
  }
  return n;
}

int main() {
  int n;
  cin >> n;
  int a[10][10] = {};
  for (int i = 1; i <= n; i++) {
    a[f(i)][i%10]++;
  }
  int ans = 0;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      ans += a[i][j] * a[j][i];
    }
  }
  cout << ans << endl;
}