#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
using namespace std;
int main(){
    ll n,ans=0;
    cin>>n;
    ll num[10][10]={};
    erep(i,1,n){
        ll buf=i;
        while(buf>=10)buf/=10;
        num[buf][i%10]++;
    }
    rep(i,0,10)rep(j,0,10)ans+=num[i][j]*num[j][i];
    cout<<ans<<endl;
}
