module String = struct
  include String

  let split str delim =
    let rec doit s acc =
      match
        try Some (String.rindex s delim) with _ -> None
      with
      | None -> s :: acc
      | Some i ->
          let s1 = String.sub s 0 i in
          let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
          doit s1 (s2 :: acc)
    in
    doit str []

end

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 (String.split (read_line ()) ' ')) in
  let _ = read_int () in
  let t = List.map int_of_string (String.split (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)