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