#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int n,cnt=0;
  cin >> n;
  vector<vector<int> > vec(10,vector<int>(10,0));
  string tmp;
  rep(i,n){
    tmp=to_string(i+1);
    vec.at(tmp[0]-'0').at(tmp[tmp.length()-1]-'0')++;
  }
  rep(i,9){
    rep(j,9){
      cnt+=vec.at(i+1).at(j+1)*vec.at(j+1).at(i+1);
    }
  }
  cout << cnt << endl;
}