package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

func max(m map[string]int)int{
	var result int
	for _,val := range m {
		if result < val{
			result = val
		}
	}
	return result
}

func main(){
	var N,M int
	blueCards := make(map[string]int)
	redCards := make(map[string]int)

	input := bufio.NewScanner(os.Stdin)
	input.Scan()
	N,_ = strconv.Atoi(input.Text())

	for i := 0;i < N;i++ {
		input.Scan()
		blueCards[input.Text()]++
	}

	input.Scan()
	M,_ = strconv.Atoi(input.Text())
	for i:= 0;i < M;i++ {
		input.Scan()
		redCards[input.Text()]++
	}
	
	buffer := make(map[string]int)
	for blueWord,blueVal := range blueCards{
		buffer[blueWord] = blueVal
		for redWord,redVal := range redCards{
			if redWord == blueWord {
				buffer[blueWord] = blueVal - redVal
			}
		}
	}

	fmt.Print(max(buffer))
}

