let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let hs = Array.init n @@ fun _ -> Scanf.scanf "%d " Fun.id in
  let hs' = Array.make n min_int in
  for i = 1 to m do
    Scanf.scanf "%d %d\n" @@ fun a b ->
      hs'.(a - 1) <- max hs.(b - 1) hs'.(a - 1);
      hs'.(b - 1) <- max hs.(a - 1) hs'.(b - 1)
  done;
  Printf.printf "%d\n" @@
  List.fold_left ( + ) 0 @@
  List.init n @@ fun i -> if hs'.(i) < hs.(i) then 1 else 0
