program AGC006A
    implicit none
    integer(8)::N,i,j,dupe,flg
    character(100)::s,t
    dupe=0
    read(5,*)N,s,t

    do i=1,N
        flg=1
        do j=1,i
            if(s(N-i+j:N-i+j)/=t(j:j))flg=0
        end do
        if(flg==1)dupe=max(dupe,i)
    end do
    print'(i0)',2*N-dupe
end program AGC006A