import Foundation

func readInt() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func counter(_ seq: [String]) -> [String: Int] {
    var count = [String:Int]()
    for e in seq {
        if count.contains(where: {$0.key == e}) {
            count[e]! += 1
        } else {
            count[e] = 1
        }
    }
    return count
}

func main() {
    let N = Int(readLine()!)!
    let s = counter((1...N).map { _ in readLine()! })

    let M = Int(readLine()!)!
    let t = counter((1...M).map { _ in readLine()! })

    var ans = 0
    for (label, blueCount) in s {
        if let redCount = t[label] {
            if blueCount > redCount {
                ans = max(ans, blueCount - redCount)
            }
        } else {
            ans = max(ans, blueCount)
        }
    }

    print(ans)
}


main()