let range ?(d=1) m n =
  let () = if d < 0 then failwith "range : d cannot be negative" in
  let rec iter i res =
    if i >= m then iter (i - d) (i::res)
    else res in
  let rec iter2 i res =
    if i <= m then iter2 (i + d) (i::res)
    else res in
  if m <= n then iter (n - ((n + m) mod d)) []
  else iter2 (n - ((n + m) mod d)) []

let (--) m n = range m n

let pr x = print_endline @@ string_of_int x

let n = Scanf.scanf "%d\n" (fun x -> x)

let b_cand = List.map (fun _ -> Scanf.scanf "%s\n" (fun x -> x)) (1--n)

let m = Scanf.scanf "%d\n" (fun x -> x)

let r_cand = List.map (fun _ -> Scanf.scanf "%s\n" (fun x -> x)) (1--m)

let b_count q = List.fold_left (fun cnt v -> if v = q then cnt + 1 else cnt) 0 b_cand

let r_count q = List.fold_left (fun cnt v -> if v = q then cnt - 1 else cnt) 0 r_cand

let () = List.map (fun q -> b_count q + r_count q) b_cand
         |> List.sort_uniq (fun a b -> compare b a)
         |> List.hd
         |> max 0
         |> pr
