Imports System.Collections.Generic
Imports System.Console

Module Program
    Dim dic As New Dictionary(Of String, Integer)

    Sub Main()
        Dim N As Integer = NextInt()
        Register(N, 1)
        Dim M As Integer = NextInt()
        Register(M, -1)

        Dim ans As Integer

        For Each v As Integer In dic.Values
            ans = Math.Max(ans, v)
        Next

        WriteLine(ans)
    End Sub

    Sub Register(n As Integer, t As Integer)
        For i As Integer = 0 To n - 1
            Dim s As String = ReadLine()
            If dic.ContainsKey(s) Then
                dic(s) += t
            Else
                dic(s) = t
            End If
        Next
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module
