INTEGER N
CHARACTER(20),ALLOCATABLE,DIMENSION(:)::S
INTEGER M
CHARACTER(20) AKIBAKO
INTEGER,ALLOCATABLE,DIMENSION(:)::KOSU
READ*,N
ALLOCATE(S(N))
READ*,S
READ*,M
!バブルソートで辞書順に
  do i=1,N-1
     do j=i+1,N
        if( LGT(S(I),S(J)) )then
           AKIBAKO=S(I)
           S(I)=S(J)
           S(J)=AKIBAKO
        end if
     end do
  end do
ALLOCATE(KOSU(N))
KOSU=0
DO I=1,N
  IF(I>1.AND.S(I)==S(I-1))THEN
    KOSU(I)=KOSU(I-1)+1
  ELSE
    KOSU(I)=1
  ENDIF
END DO
DO I=1,M
  READ*,AKIBAKO
  DO J=1,N
    IF(AKIBAKO==S(J))KOSU(J)=KOSU(J)-1
  END DO
END DO
PRINT"(I0)",MAX(MAXVAL(KOSU),0)
END