import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    print $ solve n

solve n = 2 * (solve'' n) - (solve' n)
solve'' n = length [() | a <- [1..n], b <- [1..a], check a b, check b a]
solve' n = length [() | a <- [1..n] , check a a]

check :: Int -> Int -> Bool
check a b = head (show a) == last (show b)