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 i = 0 to n - 1 do if String.(sub s i (n - i) = sub t 0 (n - i)) then f (n - i) done; f 0