#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N; cin>>N;
  vector<ll>A(100,0);
  for(int i=1; i<=N; i++){
    ll a=i%10;
    if(a==0) continue;
    ll temp=i,c;
    while(temp>=10) temp/=10;
    c=temp*10+a;
    A[c]++;
  }
  ll ans=0;
  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      ll a=i*10+j, b=i+j*10;
      ans+=A[a]*A[b];
    }
  }
  cout<<ans<<endl;
}