'use strict'

function Main(input) {

  input = input.trim()
  const N = parseInt(input)

  let c = 0
  for(let i = 1; i <= N; ++i) {
    const a = `${i}`
    for(let j = 1; j <= N; ++j) {
      const b = `${j}`

      const al = a[a.length - 1]
      const bt = b[0]

      const at = a[0]
      const bl = b[b.length - 1]

      if (al === bt && at === bl) c++


    }
  }

  console.log(c)
 
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
