#!/bin/sh
export LC_ALL=C
read n
read s
read t
if [ "$s" = "$t" ]
then
	echo $n
	exit
fi
for i in `seq $n`
do
	cnt=$((i - 1))
	if [ `echo $t | egrep -c "^${s:$cnt:$n}"` -eq 1 ]
	then
		ans="${s/${s:$cnt:$n}/}$t"
		break
	fi
done
if [ ! "${ans}" ]
then
	ans=$s$t
fi
echo ${#ans}
