#include <iostream>
#include <string>

using namespace std;

int main() {
	int n; cin >> n;
	int cnt[10][10] = {};
	for (int i = 1; i <= n; ++i)
		++cnt[to_string(i)[0] - '0'][i % 10];
	int ans = 0;
	for (int i = 0; i < 10; ++i)
		for (int j = 0; j < 10; ++j)
			ans += cnt[i][j] * cnt[j][i];
	cout << ans << endl;

	return 0;
}