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

let binary_search l value =
  let rec loop left right =
    let mid = (left+right)/2 in
    if mid = left then
      if l.(left) = value then 1
      else if l.(right) = value then 1
      else 0
    else
      let (left_new, right_new) =
        if l.(mid) > value then (left,mid-1)
        else if l.(mid) < value then (mid+1, right)
        else (left, mid)
      in
      loop left_new right_new
  in loop 0 ((Array.length l)-1)
;;

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