class IntArray2D(val size1: Int, val size2: Int) {
    private val innerArray = IntArray(size1 * size2)

    operator fun get(i1: Int, i2: Int): Int = innerArray[i2 + size2 * i1]

    operator fun set(i1: Int, i2: Int, v: Int) {
        innerArray[i2 + size2 * i1] = v
    }
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val table = IntArray2D(10, 10)
    for (i in 1..n) {
        val si = i.toString()
        table[si.first() - '0', si.last() - '0'] += 1
    }
    var count = 0L
    for (i in 0 until 10) {
        for (j in 0 until 10) {
            count += table[i, j].toLong() * table[j, i].toLong()
        }
    }
    println(count)
}