#include <bits/stdc++.h>
using namespace std;
int saijouiNum(long long num) {
  int saijoui;
  while (num > 0) {
    saijoui = num;
    num = num / 10;
  }
  return saijoui;
}
int main(void) {
  int n;
  cin >> n;
  long long count = 0;
  map<pair<int, int>, int> freq;
  for (int i = 1; i <= n; i++) {
    pair<int, int> tmp;
    tmp.first = i % 10;
    tmp.second = saijouiNum(i);
    freq[tmp]++;
  }
  for (int i = 1; i <= n; i++) {
    pair<int, int> tmp;
    tmp.second = i % 10;
    tmp.first = saijouiNum(i);
    count += freq[tmp];
  }
  cout << count << endl;
}
