#include <stdio.h>


int main() 
{
	int n, i, p10 = 1, x, y, j;
	int c[10][10] = {0}, ans = 0;
			
	scanf("%d", &n);
	for(i = 1; i <= n; i++){
		x = i / p10;
		if(x > 9) x /= 10, p10 *= 10;
		y = i % 10;
		c[x][y]++;
	}
	for(i = 1; i <= 9; i++){
		for(j = 1; j <= 9; j++){
			ans += c[i][j] * c[j][i];
		}
	}
	printf("%d\n", ans);
			
	return 0;
}