let n, ans, cs = read_int (), ref 0, Array.make_matrix 10 10 0
let rec f n = if n < 10 then n else f (n / 10)
let _ = for k = 1 to n do let h, l = f k, k mod 10 in cs.(h).(l) <- cs.(h).(l) + 1 done; for i = 1 to 9 do for j = 1 to 9 do ans := !ans + cs.(i).(j) * cs.(j).(i) done done; Printf.printf "%d\n" !ans