open System
open System.Linq

#nowarn "25"

let inline readLine _ = stdin.ReadLine()
let inline readInt<'a> = readLine >> int
let inline readLong<'a> = readLine >> int64
let inline readFloat<'a> = readLine >> float
let inline readArray _ = readLine().Split ' '
let inline readArrayInt _ = readArray() |> Array.map (int)

type Int32 =
    static member OfChar ch =
        int ch - int '0'

[<EntryPoint>]
let main _ =
    let n = readInt()
    let cnt = Array2D.zeroCreate<Int64> 10 10
    for i in 1..n do
        let head = (i
            |> string
            |> Enumerable.First
            |> Int32.OfChar)
        let tail = i % 10
        cnt.[head, tail] <- cnt.[head, tail] + 1L
    Seq.init 10 (fun i ->
        Seq.init 10 (fun j ->
            cnt.[i, j] * cnt.[j, i]))
    |> Seq.sumBy (Seq.sum)
    |> printfn "%d"

    0 // return an integer exit code
