#include <bits/stdc++.h>
using namespace std;
#include<cstdlib>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;

int main(){
  int n;
  cin >> n;

  string s,t;
  cin >> s >> t;

  rep(i,n){
    int same=n-i;

    bool check=true;
    rep(j,same){
      if(s.at(n-same+j)!=t.at(j)){check=false; break;}
    }

    if(check){cout<<n*2-same; return 0;}
  }

  cout << n*2;
}
#include <bits/stdc++.h>

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;

string res;

int main()
{
    ll a, b;
    string s;
    cin >> a >> b >> s;

    res = "Yes";
    for (int i = 0; i < s.length(); i++)
    {
        if (i == a)
        {
            if (s[i] != '-')
            {        
                res = "No";
            }
        }
        else
        {
            if (!('0' <= s[i] && s[i] <= '9'))
            {
                res = "No";
            }
        }
    }
    println(res);
}