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

int n,ans;
char a[1005],b[1005];

int main(){
	int i,j;
	scanf("%d%s%s",&n,a+1,b+1);
	for(i=n;i;--i){
		for(j=1;j<=i;++j)
		 if(a[n-i+j]!=b[j]) break;
		if(j>i) {ans=i;break;}
	}
	cout<<n+n-ans;
}