import java.io.{BufferedReader, InputStreamReader}

import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt

    val memo = new mutable.HashMap[(Char, Char), Int]()

    for {
      i <- 1 to n
    } {
      val s = i.toString
      val head = s.head
      val last = s.last

      if (last != '0') {
        val key = (head, last)
        memo.update(key, memo.getOrElseUpdate(key, 0) + 1)
      }
    }

    var count = 0
    for {
      i <- '1' to '9'
      j <- '1' to '9'
    } {
      count += memo.getOrElse((i, j), 0) * memo.getOrElse((j, i), 0)
    }

    System.out.println(count)
  }
}
