#include <bits/stdc++.h>

int main()
{
	int N;
	scanf("%d", &N);
	using vi = std::vector<int64_t>;
	using vvi = std::vector<vi>;
	vvi table(10, vi(10));
	for (int i{1}; i <= N; i++)
	{
		int top{i};
		while (top >= 10) top /= 10;
		table[i % 10][top]++;
	}
	int64_t ans{};
	for (int i{}; i < 10; i++)
		for (int j{}; j < 10; j++)
			ans += table[i][j] * table[j][i];
	printf("%lld\n", ans);

	return 0;
}