N = gets.chomp.to_i
s = Hash.new(0)
N.times do |n|
  word = gets.chomp
  s[word] += 1
end
M = gets.chomp.to_i
M.times do |n|
  word = gets.chomp
  s[word] -= 1
end
max_amount = s.max{|a,b| a[1] <=> b[1]}[1]
max_amount > 0 ? print("#{max_amount}") : print("0")