import Data.List

main = do
  n <- readLn :: IO Int
  s <- getLine
  t <- getLine
  let l = maximum $ map length $ filter (flip isPrefixOf $ t) $ map (\i -> reverse $ take i (reverse s)) [0..n]
  print $ n*2 - l
