getKeta n = head [ x | x <- [1,2..], 10 ^ x > n ]
main = do
  n <- readLn
  print . length $ [ 0 | x <- [1..n], y <- [1..n], (y `mod` 10) == (x `div` (10^(getKeta x - 1))) && (x `mod` 10) == (y `div` (10^(getKeta y - 1))) ]