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

int main(){
  int N;
  cin >> N;
  vector<vector<int>> c(10,vector<int>(10));
  int sum=0;
  int k=0;
  for(int k=1;k<=N;k++){
    int last=k%10;
    int first=k;
    while(first>9) first=first/10;
    c.at(first).at(last)++;
  }
  for(int i=0;i<=9;i++){
    for(int j=0;j<=9;j++){
      sum += c.at(i).at(j)*c.at(j).at(i);
    }
  }
  cout << sum << endl;
  
}