n = int(eval(input()))

s = eval(input())

t = eval(input())



ans = len(s + t)

for i in range(n):

    if s[i:] == t[:n-i]:

        print((n+i))

        exit()

print((n*2))
n = int(eval(input()))

s = eval(input())

t = eval(input())



for i in range(n):

    if s[i:] == t[:n-i]:

        print((n + i))

        exit()

else:

    print((n*2))
n = int(eval(input()))
s = eval(input())
t = eval(input())
ans = len(s + t)
for i in range(n):
    if s[i:] == t[: n - i]:
        print((n + i))
        exit()
print((n * 2))

n = int(eval(input()))
s = eval(input())
t = eval(input())
for i in range(n):
    if s[i:] == t[: n - i]:
        print((n + i))
        exit()
else:
    print((n * 2))

-ans = len(s + t) -print((n * 2)) +else: +    print((n * 2))