#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(long long i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
ll a[405][405],ans;
ll search(ll f) {
	while(f!=0) {
		if(f/10==0) return f;
		f/=10;
	} 
}
int main() {
	ll n;
	cin>>n;
	FOR(i,1,n+1) a[i%10][search(i)]++;
	FOR(i,1,10) FOR(j,1,10)
		ans+=a[i][j]*a[j][i];
	cout<<ans;
	return 0;
}
