let n = read_int ()
let s = read_line ()
let t = read_line ()
let f m = Printf.printf "%d\n" @@ 2 * n - m; exit 0
let _ = for l = n downto 1 do if String.(sub s (n - l) l = sub t 0 l) then f l done; f 0