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();
    // writeln(s);
    // writeln(t);
    long ans = -1;
    foreach (i; 0 .. n + 1)
    {
        if (func(s, t, i))
        {
            // writeln(s[($ - i) .. $], t[0 .. 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;
    }
    else
    {
        return false;
    }
}

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