import scala.collection.mutable.ArrayBuffer

object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val pw = new java.io.PrintWriter(System.out)
	
	val n = sc.nextInt
	
	val c = Array.fill(10)(Array.fill(10)(0))
	
	for (k <- 1 to n) {
		val s = k.toString
		val i = s.head.asDigit
		val j = s.last.asDigit
		c(i)(j) = c(i)(j) + 1 
	}
	
	pw.println((for (i <- 0 to 9; j <- 0 to 9) yield c(i)(j) * c(j)(i)).sum)
	pw.flush()
}