let linear_search x lst =
  let rec doit = function
    | [] -> false
    | hd :: _ when x = hd -> true
    | _ :: tl -> doit tl
  in
  doit lst

let () =
  let read_seq () = List.map int_of_string (Str.split (Str.regexp " ") (read_line ())) in
  let _ = read_int () in
  let s = read_seq () in
  let _ = read_int () in
  let t = read_seq () in
  Printf.printf "%d\n" (List.fold_left (fun acc e -> if linear_search e s then acc + 1 else acc) 0 t)