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

let binary_search l value =
  let rec loop left right =
    let mid = (left+right)/2 in
    if mid = left then
      if (List.nth l left) = value then
        true
      else if (List.nth l right) = value then
        true
      else
        false
    else
      if (List.nth l mid) > value then
        loop left (mid-1)
      else if (List.nth l mid) < value then
        loop (mid+1) right
      else
        true
  in loop 0 ((List.length l)-1)
;;

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