Scanf.scanf "%d %d" (fun n m ->
    let h = Array.init n (fun _ -> Scanf.scanf " %d" (fun h -> h)) in
    let nei = Array.make n [] in
    for i = 1 to m do
        Scanf.scanf " %d %d" (fun a b ->
            let a = a - 1 in let b = b - 1 in
            nei.(a) <- b :: nei.(a);
            nei.(b) <- a :: nei.(b);
        )
    done;
    let rec loop i acc =
        if i = n then acc else
            let f = List.fold_left (fun acc v -> if h.(v) >= h.(i) then false else acc) true nei.(i) in
            loop (i + 1) (if f then acc + 1 else acc)
    in
    loop 0 0 |> Printf.printf "%d\n"
)