There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.
There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.
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-----
 - 2 \leq N \leq 10^5
 - 1 \leq M \leq 10^5
 - 1 \leq H_i \leq 10^9
 - 1 \leq A_i,B_i \leq N
 - A_i \neq B_i
 - 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
H_1 H_2 ... H_N
A_1 B_1
A_2 B_2
:
A_M B_M

-----Output-----
Print the number of good observatories.

-----Sample Input-----
4 3
1 2 3 4
1 3
2 3
2 4

-----Sample Output-----
2

 - From Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.
 - From Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.
 - From Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.
 - From Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.
Thus, the good observatories are Obs. 3 and 4, so there are two good observatories.

Difficulty: introductory

Starter code:

Solutions:
N,M = map(int,input().split())
high = list(map(int,input().split()))
ans = [0]*N
cnt = 0
for i in range(M):
    a,b = map(int,input().split())
    ans[a-1] = max(high[b-1],ans[a-1])
    ans[b-1] = max(ans[b-1],high[a-1])

for j in range(N):
    if ans[j] < high[j]:
        cnt += 1
print(cnt)

N, M = list(map(int, input().split()))
H = [int(a) for a in input().split()]
X = [1] * N
for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = a-1, b-1
    if H[a] <= H[b]:
        X[a] = 0
    if H[b] <= H[a]:
        X[b] = 0
print((sum(X)))


n,m=map(int,input().split())
h=list(map(int,input().split()))
c=0
d=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    d[a-1]=max(d[a-1],h[b-1])
    d[b-1]=max(d[b-1],h[a-1])
for i in range(n):
    if h[i]>d[i]:
        c+=1
print(c)

from collections import deque
n,m = map(int,input().split())
h=list(map(int,input().split()))
g = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
ans=0
for j in range(n):
    for i in g[j]:
        if h[j]<=h[i]:
            break
    else:
        ans+=1
print(ans)

n, m = list(map(int, input().split()))
heights = list(map(int, input().split()))

neighbors = [[] for i in range(n)]

for i in range(m):
    a, b = list(map(int, input().split()))
    neighbors[a - 1].append(b - 1)
    neighbors[b - 1].append(a - 1)

count = 0
for i in range(n):
    hanamaru = True
    for j in neighbors[i]:
        if heights[i] > heights[j]:
            continue
        else:
            hanamaru = False
            break
    if hanamaru is True:
        count += 1

print(count)


n, m = [int(i) for  i in input().split()]
h = [int(i) for i in input().split()]
edges = [[] for i in range(n)]
for _ in range(m):
  edge = [int(i)-1 for i in input().split()]
  edges[edge[0]].append(edge[1])
  edges[edge[1]].append(edge[0])
cnt = 0

for i in range(n):
  flg = True
  for j in edges[i]:
    if h[i] <= h[j]:
      flg = False
      break
  if flg:
    cnt += 1
print(cnt)

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

good = [1] * N
for i in range(M):
    A, B = list(map(int, input().split()))
    A, B = A - 1, B - 1
    HA = H[A]
    HB = H[B]
    if HA == HB:
        if good[A]:
            good[A] = 0
        if good[B]:
            good[B] = 0
    elif HA < HB and good[A]:
        good[A] = 0
    elif HB < HA and good[B]:
        good[B] = 0

print((sum(good)))
return


N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
cnt=[1 for _ in range(N)]
for _ in range(M):
    A,B=list(map(int,input().split()))
    A-=1
    B-=1
    if H[A]>H[B]:
        cnt[B]=0
    elif H[A]<H[B]:
        cnt[A]=0
    else:
        cnt[A]=0
        cnt[B]=0
print((cnt.count(1)))


N,M=map(int,input().split())
Hlist=list(map(int,input().split()))
ABlist=[]
for _ in range(M):
    ABlist.append(list(map(int,input().split())))
flaglist=[1]*N
for row in ABlist:
    one=row[0]-1 #indexと番号の調整
    two=row[1]-1
    if Hlist[one]<=Hlist[two]:
        flaglist[one]=0
    if Hlist[one]>=Hlist[two]:
        flaglist[two]=0
print(sum(flaglist))

N, M = map(int,input().split())
H = list(map(int,input().split()))
A, B = [], []
for _ in range(M):
  a, b = map(int,input().split())
  A.append(a)
  B.append(b)

L = [1] * N

for i in range(M):
  ai = A[i] - 1
  bi = B[i] - 1
  if H[ai] > H[bi]:
    L[bi] = 0
  elif H[bi] > H[ai]:
    L[ai] = 0
  else:
    L[ai], L[bi] = 0, 0

print(L.count(1))

n, m = list(map(int,input().split()))

h = list(map(int,input().split()))

cnt = [0] * n

for i in range(m):
    a,b = list(map(int,input().split()))
    cnt[a-1] = max(cnt[a-1], h[b-1])
    cnt[b-1] = max(cnt[b-1], h[a-1])


    
res = sum([h[i] > cnt[i] for i in range(n)])


print(res)


N,M = list(map(int, input().split()))

H=list(map(int,input().split()))

graph=[[0] for _ in range(N)]

for i in range(M):
    A, B = list(map(int, input().split()))
    graph[A-1].append(H[B-1])
    graph[B-1].append(H[A-1])

ans=0

for i in range(N):
    if H[i]>max(graph[i]):
        ans+=1
        
print(ans)














    

                
            





    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














n,m = map(int,input().split())
h = list(map(int,input().split()))

g = [[] for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)

cnt = n
for i in range(n):
  for j in g[i]:
    if h[i] <= h[j]:
      cnt -= 1
      break
print(cnt)

N, M = list(map(int, input().split()))
height_list = list(map(int, input().split()))
road_list_1 = [list(map(int, input().split())) for i in range(M)]
road_list = [[road_list_1[j][i] - 1 for i in range(2)] for j in range(M)]
observation_deck = list(range(N))

for i in range(M):
    if height_list[road_list[i][0]] >= height_list[road_list[i][1]]:
        observation_deck[road_list[i][1]] = -1
    if height_list[road_list[i][0]] <= height_list[road_list[i][1]]:
        observation_deck[road_list[i][0]] = -1

answer = 0

for i in range(N):
    if observation_deck[i] != -1:
        answer += 1

print(answer)

N,M=map(int,input().split())
H=list(map(int,input().split()))
A=[0]*M;B=[0]*M
C=[0]*N
for i in range(M):
  A[i],B[i]=map(int,input().split())

for i in range(M):
  if H[A[i]-1]<H[B[i]-1]:C[A[i]-1]+=1
  elif H[A[i]-1]>H[B[i]-1]:C[B[i]-1]+=1
  else:C[A[i]-1]+=1;C[B[i]-1]+=1
print(C.count(0))


n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
cor = [[] for i in range(n)]

for i in range(m):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    cor[a].append(b)
    cor[b].append(a)

ans = 0
for i in range(n):
    max_h = l[i]
    cnt = 1
    co = list(set(cor[i]))
    for j in range(len(co)):
        if l[co[j]] >= max_h:
            cnt = 0
            break
    ans += cnt

print(ans)





n,m=map(int, input().split())
h=list(map(int, input().split()))
near=[[0] for i in h]
for i in range(m):
    a,b=map(int, input().split())
    near[a-1].append(h[b-1])
    near[b-1].append(h[a-1])
cnt=0
for i in range(n):
    if max(near[i])<h[i]:
        cnt+=1
print(cnt)

def main() -> None:
    n, m = list(map(int, input().split()))
    heights = tuple(map(int, input().split()))

    good = [1] * n
    for _ in range(m):
        a, b = list(map(int, input().split()))
        height_a, height_b = heights[a-1], heights[b-1]
        if height_a == height_b:
            good[a-1], good[b-1] = 0, 0
        elif height_a < height_b:
            good[a-1] = 0
        else:
            good[b-1] = 0
    print((good.count(1)))
    return


def __starting_point():
    main()

__starting_point()

N,M=map(int,input().split())
H=list(map(int,input().split()))
road=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    road[a-1].append(b)
    road[b-1].append(a)
c=0
for i in range(N):
    T=True
    for j in road[i]:
        if H[i]<=H[j-1]:
            T=False
    if T:
        c+=1
print(c)

import sys
input = sys.stdin.readline

def main():
    n , m = map( int , input().split() )
    h = list( map( int , input().split() ) )
    goods = [ 1 for i in range(n) ]
    for i in range( m ):
        a , b = map( lambda x : int(x) - 1  , input().split() )
        if ( h[a] > h[b] ):
            goods[ b ] = 0
        if ( h[a] < h[b] ):
            goods[ a ] = 0
        if ( h[a] == h[b] ):
            goods[ a ] = 0
            goods[ b ] = 0
    print( sum(goods) )
main()

n, m = map(int,input().split())
h = list(map(int,input().split()))
l = [1]*n
for i in range(m):
  a, b = map(int,input().split())
  if h[a-1] == h[b-1]:
    l[a-1] = 0
    l[b-1] = 0
  if h[a-1] > h[b-1]:
    l[b-1] = 0
  if h[a-1] < h[b-1]:
    l[a-1] = 0
print(l.count(1))

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

good = [1] * N
for i in range(M):
    A, B = list(map(int, input().split()))
    HA = H[A - 1]
    HB = H[B - 1]
    if HA == HB:
        if good[A - 1]:
            good[A - 1] = 0
        if good[B - 1]:
            good[B - 1] = 0
    elif HA < HB and good[A - 1]:
        good[A - 1] = 0
    elif HB < HA and good[B - 1]:
        good[B - 1] = 0

print((sum(good)))
return


N,M = map(int,input().split())
Hlist = list(map(int,input().split()))

anslist = [1]*N
for i in range(M):
  A,B = map(int,input().split())
  #print (Hlist[A-1])
  #print (Hlist[B-1])
  if Hlist[A-1]<Hlist[B-1]:
    anslist[A-1]=0
  elif Hlist[A-1]>Hlist[B-1]:
    anslist[B-1]=0
  elif Hlist[A-1]==Hlist[B-1]:
    anslist[A-1]=0
    anslist[B-1]=0
    
#print (anslist)
print (sum(anslist))

import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
import heapq
#import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
mod = 998244353

n,m = rl()
h = rl()
ans = [1]*n
for i in range(m):
    a,b  = rl()
    a -= 1
    b -= 1
    if h[a]>h[b]:
        ans[b]=0
    elif h[a]<h[b]:
        ans[a]=0
    else:
        ans[a], ans[b] = 0, 0
print(sum(ans))

import sys
pin=sys.stdin.readline

def main():
  N,M=map(int,pin().split())
  H=list(map(int,pin().split()))
  d=[True]*N
  ans=0
  for _ in [0]*M:
    A,B=map(int,pin().split())
    if H[A-1]>H[B-1]:
      d[B-1]=False
    elif H[B-1]>H[A-1]:
      d[A-1]=False
    else:
      d[A-1]=False
      d[B-1]=False
  for i in d:
    if i:
      ans+=1
  print(ans)
  return
main()

import sys
n,m=map(int,sys.stdin.readline().split())

data={}
h=[int(i) for i in sys.stdin.readline().split()]
for i in range(1,n+1):
    data[i]=set()

for i in range(1,m+1):
    a,b=map(int,sys.stdin.readline().split())
    data[a].add(b)
    data[b].add(a)


ans=0
for i in data:
    if len(data[i])==0:
        ans+=1
    elif all(h[i-1]>h[j-1] for j in data[i]):
        ans+=1
print(ans)

n, m = map(int,input().split())
H = list(map(int,input().split()))
AB = []
ans = 0
for i in range(m):
    AB.append(list(map(int,input().split())))
    AB[-1][0] -= 1
    AB[-1][1] -= 1
ok = [1]*n
for i in range(m):
    if H[AB[i][0]] >= H[AB[i][1]]:
        ok[AB[i][1]] = 0
    if H[AB[i][0]] <= H[AB[i][1]]:
        ok[AB[i][0]] = 0
for i in ok:
    if i:
        ans += 1
print(ans)

N, M = list(map(int, input().split()))
list_h = list(map(int, input().split()))
table = [1] * N

for i in range(M):
  A, B = list(map(int, input().split()))
  if list_h[B-1] < list_h[A-1]:
    table[B-1] = 0
  elif list_h[A-1] < list_h[B-1]:
    table[A-1] = 0
  else:
    table[A-1] = 0
    table[B-1] = 0

print(str(sum(table)))

N,M = map(int,input().split())
array = list(map(int,input().split()))
ans = [1]*N
for i in range (M):
  A,B = map(int,input().split())
  if array[A - 1] < array[B - 1]:
    ans[A - 1] = 0
  elif array[A - 1] > array[B - 1]:
    ans[B - 1] = 0
  else:
    ans[A-1],ans[B-1] = 0,0
print( sum(ans) )

import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n, m = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()]for j in range(m)]    # nは行数

tmp = [True for i in range(n + 1)]
res = 0

for i in range(m):
    a, b = A[i]
    if H[a - 1] <= H[b - 1]:
        tmp[a] = False
    if H[a - 1] >= H[b - 1]:
        tmp[b] = False
for i in range(1, n + 1):
    if tmp[i]:
        res += 1

print(res)


n,m=list(map(int,input().split()))
H=list(map(int,input().split()))
ans = [1]*n
for i in range(m):
  a,b=list(map(int,input().split()))
  if H[a-1]>=H[b-1]:
    ans[b-1] = 0
  if H[a-1]<=H[b-1]:
    ans[a-1] = 0
print((sum(ans)))


n,m = map(int,input().split())
H = list(map(int,input().split()))
L = [1]*n
for _ in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  if H[a] == H[b]:
    L[a] = 0
    L[b] = 0
  elif H[a] < H[b]:
    L[a] = 0
  elif H[a] > H[b]:
    L[b] = 0
print(sum(L))

N, M = list(map(int, input().split()))

h = list(map(int, input().split()))
all_dict = {}
for m in range(M):
    a, b = list(map(int, input().split()))
    
    a -= 1
    b -= 1
    
    all_dict.setdefault(a, [])
    all_dict.setdefault(b, [])

    all_dict[a].append(b)
    all_dict[b].append(a)

total_good = 0

for i in range(N):
    is_good = 1
    all_dict.setdefault(i, [])
    for around_h in all_dict[i]:
        if h[around_h] >= h[i]:
            is_good = 0
    total_good += is_good

print(total_good)




N,M = map(int, input().split())

H=list(map(int,input().split()))

graph=[[0] for _ in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    graph[A-1].append(H[B-1])
    graph[B-1].append(H[A-1])

ans=0

for i in range(N):
    if H[i]>max(graph[i]):
        ans+=1
        
print(ans)

def main():
    import collections
    n, m = list(map(int, input().split()))
    hs = list(map(int, input().split()))
    nmap = [0] * n
    cnt = 0

    for j in range(m):
        v = input().split()
        v0 = int(v[0]) - 1
        v1 = int(v[1]) - 1
        if hs[v0] < hs[v1]:
            nmap[v0] += 1
        elif hs[v0] == hs[v1]:
            nmap[v0] += 1
            nmap[v1] += 1
        else:
            nmap[v1] += 1
    for i in nmap:
        if i == 0:
            cnt += 1
    return cnt


def __starting_point():
    print((main()))

__starting_point()

import copy
N,M=list(map(int, input().split()))
num_list = list(map(int, input().split()))
list1=copy.copy(num_list)
for i in range(M):
    A,B=list(map(int, input().split()))
    if num_list[A-1]<num_list[B-1]:
        list1[A-1]=0
    elif num_list[A-1]>num_list[B-1]:
        list1[B-1]=0
    else:
        list1[A-1]=0
        list1[B-1]=0

s=0
for j in list1:
    if j>0:
        s=s+1

print(s)


n, m = list(map(int, input().split()))
h = [int(s) for s in input().split()]
ab = []

for i in range(m):
    ab.append([int(s) for s in input().split()])

h2 = []
for p in ab:
    if h[p[0] - 1] <= h[p[1] - 1]:
        h2.append(p[0] - 1)
    if h[p[0] - 1] >= h[p[1] - 1]:
        h2.append(p[1] - 1)

print((len(h) - len(list(set(h2)))))


N,M = map(int,input().split())
H = list(map(int,input().split()))

miti = []
for i in range(M):
    miti.append(list(map(int,input().split())))

count = []
for i in range(N):
    count.append(1)

for i in range(M):
    if H[miti[i][0]-1] < H[miti[i][1]-1]:
        count[miti[i][0]-1]=0

    if H[miti[i][0]-1] > H[miti[i][1]-1]:
        count[miti[i][1]-1]=0

    if H[miti[i][0]-1] == H[miti[i][1]-1]:
        count[miti[i][0]-1]=0
        count[miti[i][1]-1]=0

ans = 0
for i in range(N):
    ans += count[i]

print(ans)

n,m = list(map(int,input().split()))
h = [0]+list(map(int,input().split()))

route = [[0] for _ in range(n+1)]
for _ in range(m):
    a,b = list(map(int,input().split()))
    route[a].append(h[b])
    route[b].append(h[a])

cnt=0
for i in range(1,n+1):
    if h[i]>max(route[i]):
        cnt+=1
print(cnt)


N, M = map(int, input().split())
H = list(map(int, input().split()))
H.insert(0, 0)
t = [True] * (N+1)

for i in range(M):
    a, b = map(int, input().split())
    if H[a] <= H[b]:
        t[a] = False
    if H[b] <= H[a]:
        t[b] = False

c = 0
for i in range(1, N+1, 1):
    if t[i]:
        c += 1

print(c)

n, m = map(int, input().split())

h = list(map(int, input().split()))

ans = [0] * n

for i in range(m):
    a, b = map(int, input().split())
    ans[a - 1] = max(ans[a - 1], h[b - 1])
    ans[b - 1] = max(ans[b - 1], h[a - 1])

anser = 0

for i in range(n):
    if ans[i] < h[i]:
        anser += 1

print(anser)

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
adj_max = [0]*N
ans = 0
for _ in range(M):
  tmp1, tmp2 = list(map(int, input().split()))
  adj_max[tmp1-1] = max(adj_max[tmp1-1], H[tmp2-1])
  adj_max[tmp2-1] = max(adj_max[tmp2-1], H[tmp1-1])
for num in range(N):
  if H[num] > adj_max[num]:
    ans += 1
print(ans)



#ABC166
N,M=map(int,input().split())
H =list(map(int,input().split()))  #展望台の標高
A = list(range(1,N+1))
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        A[b-1] = 0
    elif H[a-1] < H[b-1]:
        A[a-1] = 0
    else:
        A[a-1] = 0
        A[b-1] = 0
print(N-A.count(0))

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(m)]

good = [True]*n

for i in range(m):
    if h[ab[i][0]-1] < h[ab[i][1]-1]:
        good[ab[i][0]-1] = False
    elif h[ab[i][0]-1] > h[ab[i][1]-1]:
        good[ab[i][1]-1] = False
    else:
        good[ab[i][0]-1] = False
        good[ab[i][1]-1] = False

#print(good)
print((good.count(True)))


N, M = map(int, input().split())
H = list(map(int, input().split()))

# N,M=O(10^5)なので、O(N+M)で解く
# 各ノードについて、隣接する展望台の高さの最大値を更新する
neighbor_max = [0] * N
for _ in range(M):
  A, B = map(int, input().split())
  neighbor_max[A - 1] = max(neighbor_max[A - 1], H[B - 1])
  neighbor_max[B - 1] = max(neighbor_max[B - 1], H[A - 1])

# 各ノードについて、自身の高さと、隣接する展望台の高さの最大値を比較する
# 接続を一つも持たないノードについても、計算は正しい
ans = 0
for i in range(N):
  if H[i] > neighbor_max[i]: ans += 1
    
print(ans)

n, m = map(int, input().split())
height = [0] + list(map(int, input().split()))
mawari = [0] * (n+1) 
ans = 0

for _ in range(m):
    a, b = map(int, input().split())
    mawari[a] = max(mawari[a], height[b])
    mawari[b] = max(mawari[b], height[a])
    

for i in range(1,n+1):
    if height[i]> mawari[i]:
        ans += 1
print(ans)

def i_input(): return int(input())


def i_map(): return list(map(int, input().split()))


def i_list(): return list(map(int, input().split()))


def i_row(N): return [int(input()) for _ in range(N)]


def i_row_list(N): return [list(map(int, input().split())) for _ in range(N)]


n,m= i_map()
hh=i_list()
ab=i_row_list(m)
t=[1]*n
for a,b in ab:
    if hh[a-1]<=hh[b-1]:
        t[a-1]=0
    if hh[b-1]<=hh[a-1]:
        t[b-1]=0
print((sum(t)))




def main():
    n, m = map(int, input().split(" "))
    ls=[{} for _ in range(n)]
    h = list(map(int, input().split(" ")))
    for i in range(n):
        ls[i] = [h[i]]
    ab = []
    for i in range(m):
        ab.append(list(map(lambda i:int(i)-1, input().split(" "))))
    for i in range(m):
        if ls[ab[i][0]][0] >= ls[ab[i][1]][0]:
            ls[ab[i][1]].append(ls[ab[i][0]][0]+1)
        if ls[ab[i][1]][0] >= ls[ab[i][0]][0]:
            ls[ab[i][0]].append(ls[ab[i][1]][0] + 1)
    cnt = 0
    for i in range(n):
        if ls[i][0] == max(ls[i]):
            cnt += 1
    print(cnt)

        

    

def __starting_point():
    main()
__starting_point()

n,m=map(int,input().split())
way=[[] for i in range(n)]
H = list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    way[a-1].append(b-1)
    way[b-1].append(a-1)

for i in range(n):
    way[i]=list(set(way[i]))

ans=0
for i in range(n):
    high=True
    for j in way[i]:
        if H[i]<=H[j]:
            high=0
            break
    if high:
        ans+=1
print(ans)

N, M = map(int, input().split())
H = list(map(int, input().split()))

graph = [[] for _ in range(N)]

for query in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

ans = 0

for now in range(N):
    good = True
    for neighbor in graph[now]:
        if H[now] <= H[neighbor]:
            good = False
    if good:
        ans += 1
        #print(now)

print(ans)

N, M = map(int, input().split())
H = list(map(int, input().split()))
ways = [list(map(int, input().split())) for i in range(M)]
observatoryList = [1] * N
for i in range(M):
  if H[ways[i][0] - 1] <= H[ways[i][1] - 1]:
    observatoryList[ways[i][0] - 1] = 0
  if H[ways[i][0] - 1] >= H[ways[i][1] - 1]:
    observatoryList[ways[i][1] - 1] = 0
goodObservatoryCount = observatoryList.count(1)
print(goodObservatoryCount)

# nは展望台の数　mは道の数
n,m = list(map(int,input().split()))
high = list(map(int,input().split()))

a = []

for x in range(m):
    b = list(map(int,input().split()))
    a.append(b)


loser = []

for y in a:
    high1 = high[y[0]-1]
    high2 = high[y[1]-1]
    if high1 > high2:
        loser.append(y[1])
    elif high1 ==  high2:
        loser.append(y[0])
        loser.append(y[1])
    else:
        loser.append(y[0])

new_loser = list(set(loser))
print((n-len(new_loser)))


n, m = map(int, input().split())
h = list(map(int, input().split()))
c = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    c[a].append(b)
    c[b].append(a)

ans = 0
for i in range(n):
    high = h[i]
    for j in c[i]:
        if h[j] >= high:
            break
    else:
        ans += 1
print(ans)

n,m = map(int,input().split())
h = list(map(int,input().split()))
flg = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] > h[b-1]:
        flg[b-1] = 0
    elif h[a-1] == h[b-1]:
        flg[a-1],flg[b-1] = 0,0
    else:
        flg[a-1] = 0
print(flg.count(1))

n,m = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
a,b = [],[]
for i in range(m):
  a1,b1 = [int(x) for x in input().split()]
  a.append(a1-1)
  b.append(b1-1)
ans = [1] * n
for i in range(m):
  if h[a[i]] < h[b[i]]:
    ans[a[i]] = 0
  elif h[a[i]] > h[b[i]]:
    ans[b[i]] = 0
  else:
    ans[a[i]] = 0
    ans[b[i]] = 0
c = 0
for i in range(n):
  if ans[i] == 1:
    c += 1
#print(ans)
print(c)

n,m=map(int,input().split())                       
h =list(map(int,input().split()))
cnt = 0
l = [[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split()) 
    l[a-1].append(h[b-1])
    l[b-1].append(h[a-1])

for i in range(n):
    if l[i] == []:
        cnt+=1

    elif h[i] > max(l[i]):
        cnt +=1
    

print(cnt)

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N, M = MI()
    H = LI()
    G = [[] for i in range(N)]
    for i in range(M):
        a, b = MI()
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    res = [-1] * N
    for i in range(N):
        if res[i] != -1:
            continue
        h = H[i]
        ans = True
        for index in G[i]:
            temp_H = H[index]
            if h > temp_H:
                res[index] = 0
            else:
                ans = False
                break
        if ans:
            res[i] = 1
        else:
            res[i] = 0
    ans = 0
    for i in res:
        if i != 0:
            ans+=1
    print(ans)

def __starting_point():
    main()
__starting_point()

N,M = map(int,input().split())

H = list(map(int,input().split()))

ans = 0

H2 = []
for i in range(N):
    H2.append([0])

for i in range(M):
    A,B = map(int,input().split())
    
    H2[A-1].append(H[B-1])
    H2[B-1].append(H[A-1])

for i in range(N):
    H2[i] = max(H2[i])

for i in range(N):
    if H2[i] < H[i]:
        ans += 1

print(ans)

n,m=map(int,input().split())
h=list(map(int,input().split()))
l=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]==h[b-1]:
    l[a-1]=0
    l[b-1]=0
  if h[a-1]>h[b-1]:
    l[b-1]=0
  if  h[a-1]<h[b-1]:
    l[a-1]=0
print(l.count(1))

n,m = map(int, input().split())
H = list(map(int, input().split()))
g = [1]*n

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a]<H[b]:
        g[a] = 0
    elif H[a]>H[b]:
        g[b] = 0
    else:
        g[a] = g[b] = 0
print(sum(g))

N, M = map(int, input().split())
H = list(map(int, input().split()))
A = [True for i in range(N)]
for i in range(M) :
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    if(H[a] <= H[b]) :
        A[a] = False
    if(H[b] <= H[a]) :
        A[b] = False

ans = 0
for i in range(N) :
    if(A[i]) :
        ans += 1
print(ans)

N,M = map(int,input().split())
H = list(map(int,input().split()))
glaph = [[] for _ in range(N)]

for i in range(M):
  A,B = map(int,input().split())
  A -= 1
  B -= 1
  glaph[A].append(B)
  glaph[B].append(A)
  
ans = 0
for j in range(N):
  check = True
  for k in glaph[j]:
    if H[j] <= H[k]:
      check = False
      break
  if check:
    ans += 1
    
print(ans)

[N, M] = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
dic = {}
for i in range(M):
    [a, b] = [int(i) for i in input().split()]
    if a in dic:
        dic[a].append(b)
    else:
        dic[a] = [b]
    if b in dic:
        dic[b].append(a)
    else:
        dic[b] = [a]

ans = 0
for i in range(1, N+1):
    s = H[i-1]
    t = 0
    if i in dic:
        for j in range(len(dic[i])):
            if s <= H[dic[i][j]-1]:
                t += 1
                break
        if t == 0:
            ans += 1
    else:
        ans += 1

print(ans)

n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(m)]

place = [True]*n

for i in range(m):
    a,b = ab[i][0],ab[i][1]
    if h[a-1] < h[b-1]:
        place[a-1] = False
    elif h[a-1] == h[b-1]:
        place[a-1] = False
        place[b-1] = False
    else:
        place[b-1] = False

print((place.count(True)))


N, M = map(int, input().split())
H = list(map(int, input().split()))
array = [0] * N
ans = 0

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    array[A] = max(array[A], H[B])
    array[B] = max(array[B], H[A])

for j in range(N):
    if array[j] < H[j]:
      ans += 1

print(ans)

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]
l = [1 for _ in range(n)]

for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        l[a[i]-1] = 0
    elif h[a[i]-1] > h[b[i]-1]:
        l[b[i]-1] = 0
    else:
        l[b[i]-1] = 0
        l[a[i]-1] = 0

print((l.count(1))) 


N,M = map(int,input().split())
H = [int(i) for i in input().split()]
A = []
B = []
for i in range(M):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
I = []
ans = 0
for i in range(1,N+1):
    I.append([i])
for i in range(M):
    I[A[i]-1].append(B[i])
    I[B[i]-1].append(A[i])
for i in range(N):
    count = 0
    a = H[i]
    if(count < 2):
        for j in range(len(I[i])):
            if(H[I[i][j]-1] >= a):
                count += 1
    if(count < 2):
        ans += 1
print(ans)

def __starting_point():

    #隣接リスト(graph)
    n,m = list(map(int,input().split()))
    H = [int(h) for h in input().split()]

    graph = [[]for _ in range(n)]

    for _ in range(m):
        a,b = list(map(int,input().split()))
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)

    #このリストから相手との関係を調べてよい展望台かどうか調べる？
    good = 0
    for i,g in enumerate(graph):
        moto = H[i]
        flg = True
        for sk in g:
            saki = H[sk]
            if moto <= saki:
                flg = False
                break
        if flg:
            good += 1
    print(good)


__starting_point()

# C - Peaks

n,m = list(map(int, input().split()))
h = list(map(int,input().split()))
ab = []
for i in range(m):
    ab.append(list(map(int,input().split())))

peak = [1]*n
for i in range(m):
    if h[ab[i][0]-1] >= h[ab[i][1]-1]:
        peak[ab[i][1]-1] = 0
    if h[ab[i][0]-1] <= h[ab[i][1]-1]:
        peak[ab[i][0]-1] = 0
print((sum(peak)))


n,m = map(int,input().split())
h = list(map(int,input().split()))
la = [0] * n
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    la[a] = max(la[a],h[b])
    la[b] = max(la[b],h[a])

ans = 0
    
for i in range(n):
    if la[i] < h[i]:
        ans += 1
        
print(ans)

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
ans = [1]*n
for i in range(m):
    if h[ab[i][0]-1] == h[ab[i][1]-1]:
        ans[ab[i][0]-1] = 0
        ans[ab[i][1]-1] = 0
    elif h[ab[i][0]-1] > h[ab[i][1]-1]:
        ans[ab[i][1]-1] = 0
    else:
        ans[ab[i][0]-1] = 0
print((sum(ans)))


N, M = list(map(int,input().split()))
H = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(M)]

path = [[] for _ in range(N)]
for a,b in AB:
  a,b = a-1, b-1
  path[a].append(b)
  path[b].append(a)
  
ans = 0
for i,p in enumerate(path):
  h = H[i]
  tmp = 0
  for pp in p:
    tmp = max(tmp, H[pp])
  if tmp<h:
    ans+=1
  
print(ans)


#!/usr/bin/env python3

N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
h_dict = {i + 1: h for i, h in enumerate(h_list)}
h_set = set(h_dict.keys())
no_list = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    if h_dict[a] == h_dict[b]:
        no_list.append(a)
        no_list.append(b)
    elif h_dict[a] > h_dict[b]:
        no_list.append(b)
    else:
        no_list.append(a)

no_set = set(no_list)
ans = len(h_set - no_set)

print(ans)


n, m = map(int, input().split())
h = list(map(int, input().split()))
D = dict()
for i in range(1, n+1):
    D[i] = h[i-1]
L = [1 for i in range(n)]
for _ in range(m):
    a, b =map(int, input().split())
    if D[a] > D[b]:
        L[b-1] = 0
    elif D[a] == D[b]:
        L[a-1] = 0
        L[b-1] = 0
    else:
        L[a-1] = 0
ans = 0
for e in L:
    ans += e
print(ans)



N, M = map(int,input().split())
H = list(map(int, input().split()))
A = [0]*M
B = [0]*M
Lists = [[] for _ in range(N)]
for i in range(M):
    A[i], B[i] = map(lambda x: int(x)-1, input().split())
    Lists[A[i]].append(B[i]) 
    Lists[B[i]].append(A[i]) 

#print(Lists)
ans = 0
for i in range(N):
    Heighest = 0
    #print(Lists[i])
    #print("H[i]:", H[i])
    for j in range(len(Lists[i])):
        #print("H[List[i][j]]:", H[Lists[i][j]])  
        Heighest = max(Heighest, H[ Lists[i][j] ])
    #print(Heighest)
    #print(H[i])
    if Heighest <H[i]:
        #print("Heighest = ", Heighest)
        ans += 1

print(ans)

n,m=map(int,input().split())
h=list(map(int,input().split()))
r=[]

t=['W']*n

for i in range(m):
    a,b=list(map(int,input().split()))
    if h[a-1]>=h[b-1]:
        t[b-1]='L'
    if h[a-1]<=h[b-1]:
        t[a-1]='L'
print(t.count('W'))

n, m = list(map(int,input().split()))
lst = list(map(int,input().split()))
lst2 = []
for i in range(n):
    lst3 = [lst[i]]
    lst2.append(lst3)

for i in range(m):
    a, b = list(map(int,input().split()))
    a = a - 1
    b = b - 1
    lst2[a].append(lst2[b][0])
    lst2[b].append(lst2[a][0])

ans = 0
for i in range(n):
    x = lst2[i][0]
    lst2[i].sort()
    lst2[i].reverse()
    if (len(lst2[i]) == 1):
        ans = ans + 1
    elif (x == lst2[i][0]):
        lst2[i].pop(0)
        y = lst2[i][0]
        if (x != y):
            ans = ans + 1

print(ans)


n,m = list(map(int, input().split()))
h = list(map(int, input().split()))
hoge = [[] for _ in range(n)]
for i in range(m):
  a,b = list(map(int, input().split()))
  hoge[a - 1].append(b - 1)
  hoge[b - 1].append(a - 1)
  
cnt = 0
for i in range(n):
  if hoge[i]:
    flag = True
    for j in hoge[i]:
      if h[i] <= h[j]:
        flag = False
    if flag:
      cnt += 1
  else:
    cnt += 1
        
print(cnt)

import copy

n,m = list(map(int, input().split()))
h = [0] + list(map(int, input().split()))

towers = [[] for _ in range(n + 1)]

for i in range(m):
    a, b = list(map(int, input().split()))
    towers[a].append(b)
    towers[b].append(a)

cnt = 0
for i in range(1, n + 1):
    for j in towers[i]:
        if h[i] <= h[j]:
            break
    else:
        cnt += 1

print(cnt)
            


n,m=list(map(int,input().split()))
h=list(map(int,input().split()))
A=[[] for i in range(n)]
for i in range(m) :
    a,b=list(map(int,input().split()))
    A[a-1].append(h[b-1])
    A[b-1].append(h[a-1])

count=0
for i in range(n) :
    if A[i]==[] :
        count+=1
    elif max(A[i])<h[i] :
        count+=1
    else :
        continue

print(count)    



n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
neighbor = [[] for _ in range(n)]

for i in range(m):
    a, b = list(map(int, input().split()))
    neighbor[a - 1].append(b - 1)
    neighbor[b - 1].append(a - 1)

cnt = 0
for i in range(n):
    if all([h[i] > h[j] for j in neighbor[i]]):
        cnt += 1
print(cnt)

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
peaks = [1] * N
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A - 1] > H[B - 1]:
        peaks[B - 1] = 0
    elif H[B - 1] > H[A - 1]:
        peaks[A - 1] = 0
    else:
        peaks[A - 1] = 0
        peaks[B - 1] = 0

print((sum(peaks)))


n,m = map(int,input().split())
H = list(map(int,input().split()))
L = [1]*n
for _ in range(m):
  a,b = map(int,input().split())
  if H[a-1] == H[b-1]:
    L[a-1] = 0
    L[b-1] = 0
  elif H[a-1] < H[b-1]:
    L[a-1] = 0
  elif H[a-1] > H[b-1]:
    L[b-1] = 0
print(sum(L))

from collections import defaultdict

N, M = map(int, input().split())
H = list(map(int, input().split()))

edge = defaultdict(list)

for i in range(M):
    a, b = map(int, input().split())
    edge[a - 1].append(H[b - 1])
    edge[b - 1].append(H[a - 1])

ans = 0
for i in range(N):
    if len(edge[i]) == 0 or H[i] > max(edge[i]):
        ans += 1

print(ans)

def main():
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    hf = [0] * n
    for i in range(m):
        a, b = list(map(int, input().split()))
        if h[a-1] > h[b-1]:
            hf[b-1] = 1
        elif h[a-1] == h[b-1]:
            hf[a-1] = 1
            hf[b-1] = 1
        else:
            hf[a-1] = 1
    print(hf.count(0))

def __starting_point():
    main()
__starting_point()

#!/usr/bin/env python3
import sys
from itertools import chain


def solve(
    N: int, M: int, H: "List[int]", A: "List[int]", B: "List[int]"
):
    ok = [1 for _ in range(N)]
    for a, b in zip(A, B):
        if H[a - 1] <= H[b - 1]:
            ok[a - 1] = 0
        if H[b - 1] <= H[a - 1]:
            ok[b - 1] = 0

    return sum(ok)


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    answer = solve(N, M, H, A, B)
    print(answer)


def __starting_point():
    main()

__starting_point()

n,m=map(int,input().split())
way=[[] for i in range(n)]
H = list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    way[a-1].append(b-1)
    way[b-1].append(a-1)
ans=0
for i in range(n):
    high=True
    for j in way[i]:
        if H[i]<=H[j]:
            high=0
            break
    if high:
        ans+=1
print(ans)

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))

g = [[] for _ in range(N+1)]
for i in range(M):
  a, b = map(int, input().split())
  g[a].append(b)
  g[b].append(a)

ans = 0
for j in range(1, N+1):
  for k in g[j]:
    if H[j] <= H[k]:
      break
  else:
    ans += 1
print(ans)

# coding=utf-8

def __starting_point():
    N, M = list(map(int, input().split()))
    Hli = list(map(int, input().split()))

    #road = [[0] * 2 for i in range(M)]

    ans = [0] * N

    for i in range(M):
        A, B = list(map(int, input().split()))

        if Hli[A-1] < Hli[B-1]:
            ans[A-1] += 1

        elif Hli[A-1] == Hli[B-1]:
            ans[A - 1] += 1
            ans[B - 1] += 1
            
        else:
            ans[B-1] +=1

    #print(ans)
    print((ans.count(0)))

__starting_point()

N, M = map(int, input().split())
H = list(map(int, input().split()))
OK = [True] * N
for _ in range(M):
    A, B = map(lambda x: int(x)-1, input().split())
    if H[A] < H[B]:
        OK[A] = False
    elif H[A] > H[B]:
        OK[B] = False
    else:
        OK[A] = False
        OK[B] = False

ans = sum(OK)
print(ans)

n, m = list(map(int, input().split()))
arr = [0] + list(map(int, input().split()))
g = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    g[a].append(b)
    g[b].append(a)

ans = 0
for i in range(1, n + 1):
    for j in g[i]:
        if arr[j] >= arr[i]:
            break
    else:
        ans += 1

print(ans)


N,M = map(int,input().split())
H = list(map(int,input().split()))
mx = [0 for i in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    mx[a] = max(mx[a], H[b])
    mx[b] = max(mx[b], H[a])
ans = 0
for i in range(N):
    if H[i] > mx[i]:
        ans += 1
print(ans)

n,m = map(int,input().split())
h = list(map(int,input().split()))
l = list({i} for i in range(n+1))
for i in range(m):
    a,b = map(int,input().split())
    l[a].add(b)
    l[b].add(a)
    
for i in range(len(l)):
    l[i] = list(l[i])
good = set()
for i in range(1,len(l)):
    l[i].remove(i)
    for j in range(len(l[i])):
        if h[l[i][j]-1] >= h[i-1]:
            break
    else:
        good.add(i)
print(len(good))

n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
ans=[1]*n
for i in range(m):
    a,b=list(map(int,input().split()))
    if l[a-1]<l[b-1]:
        ans[a-1]=0
    elif l[a-1]>l[b-1]:
        ans[b-1]=0
    else:
        ans[a-1]=0
        ans[b-1]=0
print((sum(ans)))


n,m=map(int,input().split())
h=list(map(int,input().split()))

t=['W']*n

for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]>=h[b-1]:
        t[b-1]='L'
    if h[a-1]<=h[b-1]:
        t[a-1]='L'
print(t.count('W'))

n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [map(int, input().split()) for _ in range(m)]
a,b = [list(i) for i in zip(*ab)]
Max = []
for i in range(n):
    Max.append(0)
# print(Max)
ans = 0
for i in range(m):
    Max[a[i]-1] = max(Max[a[i]-1],h[b[i]-1])
    Max[b[i]-1] = max(Max[b[i]-1],h[a[i]-1])

for i in range(n):
    if h[i] > Max[i]:
        ans += 1
print(ans)

_,H,*P=open(0);*H,=map(int,[0]+H.split());T=[1]*len(H)
for p in P:
 a,b=map(int,p.split());T[min(a,b,key=lambda x:H[x])]=0
 if H[a]==H[b]:T[b]=0
print(sum(T)-1)

N, M = map(int, input().split())
H = list(map(int, input().split())) #展望台iの標高
assert len(H) == N
paths = [[] for i in range(N)]
for m in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  paths[a].append(b)
  paths[b].append(a) # 展望台AからBへの道、その逆

count = 0
for a in range(N):
  for b in paths[a]:
    if H[b] >= H[a]:
      break
  else:
    count += 1
print(count)