fun main(args: Array<String>) {
    abc152d()
}

fun abc152d() {
    val n = readLine()!!.toInt()

    val dic = Array(10) { IntArray(10) { 0 } }

    for (i in 1..n) {
        val first = i.toString().first().toString().toInt()
        val last = i.toString().last().toString().toInt()
        dic[last][first]++
    }

    var answer = 0L

    for (a in 1..n) {
        val first = a.toString().first().toString().toInt()
        val last = a.toString().last().toString().toInt()
        answer += dic[first][last]
    }

    println(answer)
}
