let bin_search x ary =
  let rec doit l r =
    if l >= r then false
    else begin
      let m = (l + r) / 2 in
      if x = ary.(m) then true
      else if x < ary.(m) then doit l m
      else doit (m + 1) r
    end
  in
  doit 0 (Array.length ary)

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 c = List.fold_left (fun cnt e -> if bin_search e s then (cnt + 1) else cnt) 0 t in
  Printf.printf "%d\n" c