#include <bits/stdc++.h>
using namespace std;
int main()
{
	int arr[10][10]={0},i,n,y,x,sum=0,j;
	cin >> n;
	for(j=1;j<=n;j++)
	{
		i =j;
		x = i%10;
		while(i/10 != 0)
			i = i/10;
		y = i;
		arr[y][x] +=1; // [First number][Last number]
	}
	sum=0;
	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
			sum += arr[i][j]*arr[j][i];
	}
	cout << sum << endl;
	return 0;
}