#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int go[10][10] = {};
int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		string s = to_string(i);
		go[s[0] - '0'][s.back() - '0']++;
	}
	for (int i = 1; i <= n; ++i) {
		string s = to_string(i);
		ans += go[s.back() - '0'][s[0] - '0'];
	}
	cout << ans << endl;
}
