fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val dic = (0..9).map { (0..9).map { 0 }.toMutableList() }
    for(i in (1..n)) {
        if(i % 10 == 0) {
            continue
        }
        val startNum = i.toString()[0].toString().toInt()
        val endNum = i % 10
        dic[startNum][endNum]++
    }
    var ans = 0L
    for(i in (1..9)) {
        for(j in (1..9)) {
            ans += dic[i][j].toLong() * dic[j][i].toLong()
        }
    }
    println(ans)
}
