object Main extends App{
  val n = readInt
  
  val m = (1 to n).map{ x => 
    (x.toString.head,x.toString.last) 
  }.groupBy(identity).mapValues(_.size).toMap
  var cnt = 0
  m.foreach{ kv =>
    val (k,v) = kv
    val rk = (k._2,k._1)
    cnt += m(k)*m.getOrElse(rk,0)
  }
  println(cnt)
}