#import <Foundation/Foundation.h>

int main() {
	@autoreleasepool {
		int n;
		char s[101];
		char t[101];
		scanf("%d %s %s",&n,s,t);
		NSString *S = [NSString stringWithUTF8String:s];
		NSString *T = [NSString stringWithUTF8String:t];
		for(int i=0;i<n;i++){
			if([[S substringFromIndex:i] isEqualToString:[T substringToIndex:n-i]]) {
				printf("%d\n",n+i);
				return 0;
			}
		}
		printf("%d\n",2*n);
	}
}