let to_list s =
  Str.split (Str.regexp_string " ") s
  |> List.map int_of_string;;

let _ = read_int () and
    s = read_line () |> to_list and
    _ = read_int () and
    t = read_line () |> to_list in
    let count = List.fold_left (fun x y -> x + (if (List.exists (fun i -> if i = y then true else false) s\
) then 1 else 0) ) 0 t in
    Printf.printf "%d\n" count
;;