open Printf
open Scanf

let id x = x

let solve n m =
  let ah = Array.init n @@ fun _ -> scanf "%d " id in
  let lab = List.init m @@ fun _ -> scanf "%d %d " @@ fun a b -> (a, b) in
  let ht = Hashtbl.create n in
  let f (a, b) =
    if ah.(a - 1) < ah.(b - 1) then Hashtbl.replace ht a true
    else if ah.(a - 1) > ah.(b - 1) then Hashtbl.replace ht b true
    else begin
        Hashtbl.replace ht a true;
        Hashtbl.replace ht b true
      end in
  List.iter f lab;
  n - Hashtbl.length ht

let () =
  scanf "%d %d " solve |> printf "%d\n"
