#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<vector<int>> cnt(10, vector<int>(10, 0));
  for (int i = 1; i <= N; i++){
    string S = to_string(i);
    cnt[S[0] - '0'][S[S.size() - 1] - '0']++;
  }
  long long ans = 0;
  for (int i = 0; i < 10; i++){
    for (int j = 0; j < 10; j++){
      ans += cnt[i][j] * cnt[j][i];
    }
  }
  cout << ans << endl;
}