import Control.Applicative

main = do
  n <- read <$> getLine :: IO Int
  s <- getLine
  t <- getLine
  if s==t
    then print n
    else print $ 2*n - length (takeWhile id (zipWith (==) (reverse s) t))
