local n=io.read("*n","*l")
local s=io.read()
local t=io.read()

local common=0
for i=1,n do
    if s:sub(#s-i+1,#s)==t:sub(1,i) then
        common=math.max(common,#t:sub(1,i))
    end
end
print(n+n-common)