let binary_search x ary =
  let rec doit l r =
    if l > r then None
    else begin
      let m = (l + r) / 2 in
      if x = ary.(m) then Some x
      else if x < ary.(m) then doit l (m - 1)
      else doit (m + 1) r
    end
  in
  doit 0 (Array.length ary - 1)

let () =
  let _ = read_int () in
  let s = Array.of_list (List.map int_of_string (Str.split (Str.regexp_string " ") (read_line ()))) in
  let _ = read_int () in
  let t = List.map int_of_string (Str.split (Str.regexp_string " ") (read_line ())) in
  let rec doit cnt = function
    | [] -> cnt
    | hd :: tl -> begin
        match binary_search hd s with
        | None -> doit cnt tl
        | Some _ -> doit (cnt + 1) tl
      end
  in
  Printf.printf "%d\n" (doit 0 t)