#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;
    int overlap = 0;
    for(int i = 1; i <= n; i++) {
        if (s.substr(n-i, i) == t.substr(0, i)) {
            overlap = i;
        }
            
    }
    cout << n*2 - overlap << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
    long long int N;
    string s,t;
    cin>>N>>s>>t;
    long long len1,len2,count=0;
    len1=s.length();
    len2=t.length();
if(len1==len2&&len1==N&&N>=1&&N<=100){
 if (N>=len1+len2){
        count=N;
 }
else {
    count=len1+len2;
        for(int i=0;i<=len1;i++){
            for(int j=1;j<=len2;j++){
                if(s.substr(i,len1)==t.substr(0,j)&&len1+len2-j>=N){
                    count=min(len1+len2-j,count);
                }
            }
        }
}
cout<<count;
}
    return 0;
}