function Main(input) {
    var N = parseInt(input[0], 10);

    var list = new Array(99);
    list.fill(0);
    var str, first, last, index, reverseIndex;
    var result = 0;

    for (var i = 1; i <= N; i++) {
        str = i.toString();
        first = str[0];
        last = str[str.length - 1];
        if (first === last) {
            index = parseInt(first, 10) - 1;
            result += list[index] * 2 + 1;
            list[index]++;
        } else if (first !== '0' && last !== '0') {
            index = parseInt(first + last, 10) - 1;
            reverseIndex = parseInt(last + first, 10) - 1;
            result += list[reverseIndex] * 2;
            list[index]++;
        }
    }

    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n/));