2496: AtCoder166 C - Peaks

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:5 Solved:5

Description

Problem Statement

There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2......, Obs. N. The elevation of Obs. i is Hi. There are also M roads, each connecting two different observatories. Road j connects Obs. Aj and Obs. Bj.
Obs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road. Note that Obs. i is also good when no observatory can be reached from Obs. i using just one road.
How many good observatories are there?

Constraints

  • 2N105
  • 1M105
  • 1Hi109
  • 1Ai,BiN
  • AiBi
  • Multiple roads may connect the same pair of observatories.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
H1 H2 ......HN 
A1 B1
A2 B2
::
AM BM

Output

Print the number of good observatories.

Sample Input Copy

4 3
1 2 3 4
1 3
2 3
2 4

Sample Output Copy

2

HINT