fun main(args: Array<String>) {
    val N = readInputLine().toInt()

    val tmp = Array(10) { IntArray(10) }
    var ans = 0

    for (i in 1..N) {
        val iStr = i.toString()
        tmp[iStr.first().toInt() - '0'.toInt()][iStr.last().toInt() - '0'.toInt()]++
    }

    for (i in 0..9) {
        for (j in 0..9) {
            ans += tmp[i][j] * tmp[j][i]
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}
