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

int main(){
  int N;
  cin >> N;
  vector<vector<long long>> A(10, vector<long long>(10));
  for (int i=1; i<=N; i++){
    string hoge = to_string(i);
    A[hoge[0]-'0'][hoge[hoge.size()-1]-'0']++;
  }
  long long ans = 0;
  for (int i=1; i<=N; i++){
    string hoge = to_string(i);
    ans += A[hoge[hoge.size()-1]-'0'][hoge[0]-'0'];
  }
  cout << ans << endl;
}
