program A324B
    implicit none
    integer(8)::N,M,ans,i,j,flg,X
    character(10),allocatable,dimension(:)::S,T
    read*,N
    allocate(S(N))
    read*,S
    read*,M
    allocate(T(M))
    read*,T
    ans=0

    do i=1,N
        flg=0
        X=0
        do j=1,N
            if(S(i)(1:len_trim(S(i)))==S(j)(1:len_trim(S(j))))X=X+1
        end do

        do j=1,M
            if(S(i)(1:len_trim(S(i)))==T(j)(1:len_trim(T(j))))X=X-1
        end do
        ans=max(ans,X)
    end do

    print'(i0)',ans
end program A324B