#include <bits/stdc++.h>
using namespace std;
int c[10][10];

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	int n;
	cin >> n;
	memset(c, 0, sizeof(c));
	for (int i = 1; i <= n; ++i){
		c[to_string(i)[0] - '0'][i % 10]++;
	}
	long long ans = 0;
	for (int i = 0; i <= 9; ++i){
		for (int j = 0; j <= 9; ++j){
			ans += (1LL * c[i][j] * c[j][i]);
		}
	}
	cout << ans;
	return 0;
}

