
#include<stdio.h>
int n;
char p[110], q[110];
int main(){
    int i, j;
    scanf("%d",&n);
    scanf("%s%s",p,q);
    for(i=n;i>=1;i--){
        for(j=0;j<i;j++){
            if(q[j] != p[n-i+j])break;
        }
        if(j==i)break;
    }
    printf("%d\n",2*n-i);
}