import Data.List

check s t c = if (drop ((length s) - c) s) == (take c t)then c else (check s t (c - 1))



main = do
      n <- readLn :: IO Int
      s <- getLine
      t <- getLine
      let c =(2 * n - (check s t n))
      if c < n then print(2*n) else print(c)