#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;

    int memo[10][10] = {};
    for (int i = 1; i <= n; ++i) {
        int e = i;
        while (e >= 10)e /= 10;
        ++memo[e][i % 10];
    }

    long long ret = 0;
    for (int i = 0; i <= n; ++i) {
        int e = i;
        while (e >= 10)e /= 10;
        ret += memo[i % 10][e];
    }

    cout << ret << endl;
}