import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    auto s = sread();
    auto t = sread();
    if (s == t)
    {
        writeln(s.length);
        return;
    }
    long ans = -1;

    foreach (i; 0 .. n)
    {
        if (func(s, t, i))
        {
            ans = max(ans, i);
        }
    }
    // writeln(ans);
    writeln((s.length + t.length) - ans);
}

bool func(string s, string t, long x)
{
    if (s[($ - x) .. $] == t[0 .. x])
    {
        return true;
    }
    return false;

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
