#include <bits/stdc++.h>
using namespace std;

int cnt[10][10];

int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        int j = i;
        while (j > 9) j /= 10;
        cnt[i % 10][j]++;
    }
    long long ans = 0;
    for (int i = 0; i < 10; i++){
        for (int j = 0; j < 10; j++){
            ans += (long long)cnt[i][j] * cnt[j][i];
        }
    }
    cout << ans << endl;
}