let words str =
  let len = String.length str in
  let buf = Buffer.create 10 in
  let rec loop cont = function
      i when i = len -> cont [Buffer.contents buf |> int_of_string]
    | i ->
      loop
        (match str.[i] with
         | ' ' ->
           let v = Buffer.contents buf |> int_of_string in
           Buffer.clear buf; (fun x -> cont (v::x))
         | c ->
           Buffer.add_char buf c; cont)
        (i+1)
  in loop (fun x -> x) 0

let bs x (a: int array) =
  let rec loop (i_min,i_max) =
    if i_min > i_max then false
    else
      let mid = (i_min+i_max)/2 in
      if a.(mid) = x then true
      else
        loop (if a.(mid) < x then mid+1,i_max else i_min,mid-1)
  in loop (0,(Array.length a) -1)

let () =
  let _ = read_int () in
  let s = read_line () |> words |> Array.of_list in
  let _ = read_int () in
  let t = read_line () |> words in
  List.fold_left (fun acc x -> if bs x s then acc+1 else acc) 0 t
  |> Printf.printf "%d\n"