(* O(k^2) (k = max n m) *)
let n = read_int () in
let ss = Array.init n @@ fun _ -> read_line () in
let m = read_int () in
let ts = Array.init m @@ fun _ -> read_line () in
let f acc s =
  let c = Array.fold_left (fun c s' -> if s' = s then c + 1 else c) 0 ss in
  max acc @@ Array.fold_left (fun c t -> if t = s then c - 1 else c) c ts in
Array.fold_left f 0 ss |> Printf.printf "%d\n"