let linear_search x ys = List.fold_left (fun acc y -> acc || (if y = x then true else false)) false ys

let () =
  let read_seq () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string in
  let _ = read_int () in
  let s = read_seq () in
  let _ = read_int () in
  let t = read_seq () in
  List.fold_left (fun acc e -> acc + (if linear_search e s then 1 else acc)) 0 t
  |> Printf.printf "%d\n"