#include <iostream>
using namespace std;
int main() {
 long long n, fl[10][10], ans = 0; cin >> n;
 for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) fl[i][j] = 0;
 for (int i = 1; i <= n; i++) {
   	int x = i;
   	while (x>=10) x/=10;
   	fl[x][i%10]++;
 }
 for (int i = 0; i < 10; i++) for (int j = 0; j < 10; j++) ans += fl[i][j]*fl[j][i];
 cout << ans << endl;
}
