let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

let f a b =
  if a = 0 then 0
  else begin
    let res = ref 0 in
    let rec g n =  if n < 10 then n else g (n / 10) in
    for i = 1 to n do
      if g i = a && i mod 10 = b then res := !res + 1
    done;
    !res
  end

let () =
  let ans = ref 0 in
  for i = 0 to 9 do
    for j = 0 to 9 do
      ans := !ans + f i j * f j i
    done
  done;
  Printf.printf "%d\n" !ans