open Batteries
module Strmap = Map.Make(String)

let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let s_lst = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%s " (fun a -> a)) in
  let m = Scanf.scanf "%d " (fun a -> a) in
  let t_lst = Array.to_list @@ Array.init m (fun _ -> Scanf.scanf "%s " (fun a -> a)) in

  let strmap = Strmap.empty in
  let strmap = List.fold_left (fun accum x -> Strmap.modify_opt x (fun v_opt -> match v_opt with
        Some v -> Some (v + 1)
      | None -> Some 1
    ) accum) strmap s_lst
  in
  let strmap = List.fold_left (fun accum x -> Strmap.modify_opt x (fun v_opt -> match v_opt with
        Some v -> Some (v - 1)
      | None -> Some (-1)
    ) accum) strmap t_lst
  in

  let assoc = Strmap.bindings strmap in
  let assoc = List.sort (fun (k1,v1) (k2,v2) -> (compare v2 v1)) assoc in
  let max = snd (List.hd assoc) in

  Printf.printf "%d\n" @@
  if max > 0 then max else 0

