peterverebics/CodeNet_Python_118 huggingface dataset:
import numpy as np
N,M = map(int,input().split())
H = np.array(list(map(int,input().split())))

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

for _ in range(M):
    a,b = map(lambda x: int(x) -1 ,input().split())
    if a in adj[b]:
        continue
    adj[a].append(b)
    adj[b].append(a)

ans = 0 
for i, item in enumerate(adj):
     if item == []:
         ans+=1
         continue
     adj_max = max(H[item])
     if H[i] > adj_max:
         ans += 1
print(ans)
N,M=map(int,input().split())
H=list(map(int,input().split()))
GoodViewpoint=[1]*N
for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]>H[b-1]:
        GoodViewpoint[b-1]=0
    elif H[a-1]<H[b-1]:
        GoodViewpoint[a-1]=0
    else:
        GoodViewpoint[a-1]=0
        GoodViewpoint[b-1]=0
        pass
print(GoodViewpoint.count(1))
N, M = map(int, input().split())

H = [None] + list(map(int, input().split()))

good = [None] + [True for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    if H[a] == H[b]:
        good[a] = False
        good[b] = False
    elif H[a] < H[b]:
        good[a] = False
    else:
        good[b] = False


ans = 0
for i in range(1, N + 1):
    if good[i]:
        ans += 1
print(ans)
H, M = map(int, input().split())

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

adjacent_heights = {i:[0] for i in range(H)}

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

is_good = [1 if heights[i] > max(adjacent_heights[i]) else 0 for i in range(H)]

print(sum(is_good))
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    G = [set() for _ in range(N)]
    for i in range(M):
        a, b = (int(i) for i in input().split())
        G[a-1].add(b-1)
        G[b-1].add(a-1)
    ans = 0
    for a in range(N):
        if all(H[b] < H[a] for b in G[a]):
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split()))for _ in range(m)]
h1=list(True for _ in range(n))
for i in range(m):
    if h[ab[i][0]-1]>=h[ab[i][1]-1]:
         h1[ab[i][1]-1]=False
    if h[ab[i][0]-1]<=h[ab[i][1]-1]:
         h1[ab[i][0]-1]=False
        
print(sum(h1))
n, m = map(int, input().split())
hList = list(map(int, input().split()))
hAns = [1] * n
for i in range(m):
    a, b = map(int, input().split())
    if hList[a - 1] > hList[b - 1]:
        hAns[b - 1] = 0
        continue
    if hList[a - 1] < hList[b - 1]:
        hAns[a - 1] = 0
        continue
    hAns[a - 1] = 0
    hAns[b - 1] = 0
print(sum(hAns))
n, m = map(int, input().split())
list1 = list(map(int, input().split()))
list2 = [1] * n
for _ in range(m):
    a, b = map(int, input().split())
    if list1[a - 1] <= list1[b - 1]:
        list2[a - 1] = 0
    if list1[a - 1] >= list1[b - 1]:
        list2[b - 1] = 0
print(list2.count(1))
n,m = map(int,input().split())
h = list(map(int,input().split()))
r = []
g = [1]*n
for i in range(m):
    ps = [int(i)-1 for i in input().split()]
    x,y = ps[0],ps[1]
    if h[x] >= h[y]:
        g[y] = 0
    if h[y] >= h[x]:
        g[x] = 0
print(sum(g))
# print('input >>')
N, M = map(int,(input().split()))
H = list(map(int,(input().split())))
ABs = []
for _ in range(M):
    ABs.append(tuple(map(int,(input().split()))))

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

for AB in ABs:
    A, B = AB
    lists[A-1] += [H[B-1]]
    lists[B-1] += [H[A-1]]

ans = 0

for i, list_ in enumerate(lists):
    if all([H[i] > h for h in list_]) or len(list_) == 0:
        ans += 1

# print('-----output-----')
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[B-1] = 0
    elif H[B-1] > H[A-1]:
        L[A-1] = 0
    else:
        L[B-1] = 0
        L[A-1] = 0
print(sum(L))
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans = [1]*n
for  _ in range(m):
    a,b=map(int,input().split())
    if h[a-1] < h[b-1]:
        ans[a-1] = 0
    elif h[a-1] > h[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 = [int(i) for i in input().split()]

paths = []
for i in range(M):
    paths.append(list(map(int, input().split())))
    paths[-1][0] -= 1
    paths[-1][1] -= 1
    
bad = set()

for path in paths:
  if H[path[0]] == H[path[1]]:
    bad.add(path[0])
    bad.add(path[1])
  elif H[path[0]] > H[path[1]]:
    bad.add(path[1])
  else:
    bad.add(path[0])
        
print(N-len(bad))
n,m = map(int,input().split())
h = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(m)]

ans = [1 for i in range(n)]

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

print(ans.count(1))
n, m = map(int, input().split())
h = list(int(i) for i in input().split())
ans = [0] * n

for i in range(m):
    a, b = map(int, input().split())
    ref = []
    if h[a - 1] <= h[b - 1]:
        ref.append(a)
    if h[a - 1] >= h[b - 1]:
        ref.append(b)
    for i in ref:
        ans[i - 1] += 1
    ref.clear()

# print(ans)
print(ans.count(0))
n, m = map(int, input().split())
h = list(map(int, input().split()))
is_good = [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]:
		is_good[a] = False
	if h[a] >= h[b]:
		is_good[b] = False

print(sum(is_good))
N,M=map(int, input().split())
peaks=list(map(int, input().split()))
flag=[1]*N
a=0
b=0
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  if peaks[a]<=peaks[b]:
     flag[a]=0
  if peaks[a]>=peaks[b]:
     flag[b]=0
ans=0
for i in flag:
  ans+=i
print(ans)
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

n,m = mp()
h = lmp()
edge = []
for i in range(n+1):
    edge.append([])
for i in range(m):
    a,b = mp()
    edge[a].append(b)
    edge[b].append(a)

ans = 0
for i in range(1, n+1):
    tar = edge[i]
    height = h[i-1]
    flag = True
    for j in range(len(tar)):
        if h[tar[j]-1] >= height:
            flag = False
    if flag:
        ans += 1
print(ans)
n, m = map(int, input().strip().split())
hs = list(map(int, input().strip().split()))
edges = [list(map(int, input().strip().split())) for _ in range(m)]

matrix = [[] for _ in range(n)]
for a, b in edges:
    matrix[a - 1].append(b - 1)
    matrix[b - 1].append(a - 1)

good = 0
for a in range(n):
    bs = matrix[a]
    h = hs[a]
    highest = all([hs[b] < h for b in bs])
    if len(bs) == 0 or highest:
        good += 1

print(good)
n,m=map(int,input().split())
h=list(map(int,input().split()))
adj=[[] for i in range(n+1)]
for i in range(m):
    u,v=map(int,input().split())
    adj[u].append(v)
    adj[v].append(u)
cnt=0
for i in range(1,n+1):
    ok=True
    for x in adj[i]:
        if h[i-1]<= h[x-1]:
            ok=False
            break
    if ok:
        cnt += 1
print(cnt)
N, M = list(map(int, input().split(' ')))
H = list(map(int, input().split(' ')))

route = [[] for i in range(N+1)]

for i in range(M):
  A, B = list(map(int, input().split(' ')))
  route[A].append(B)
  route[B].append(A)

count = 0
for i in range(1, N+1):
  route1 = route[i]
  flag = True
  for route2 in route1:
    if H[i-1] <= H[route2-1]:
      flag = False
  if flag:
    count += 1
#print(route)
print(count)
N, M = map(int, input().split(" "))
Hs = list(map(int, input().split(" ")))
candidate = set(range(1, N+1))
for _ in range(M):
    i, j = map(int, input().split(" "))
    if Hs[i - 1] >= Hs[j - 1]:
        # jは良い展望台ではない
        candidate.discard(j)
    if Hs[j - 1] >= Hs[i - 1]:
        # iは良い展望台ではない
        candidate.discard(i)
print(len(candidate))
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
h=[]
for m in range(M):
    a,b=list(map(int,input().split()))
    if a-1<=N and b-1<=N:
        if H[a-1]<=H[b-1]:
            h.append(a-1)
        if H[a-1]>=H[b-1]:
            h.append(b-1)
h2=set(h)
ans=N-len(h2)
print(ans)
import math
import pprint
import fractions
import collections
import itertools
N,M=map(int,input().split())
H=list(map(int,input().split()))
tree=[[] for _ in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
l=[1]*N
for i in range(N):
    flag=1
    for j in tree[i]:
        if H[i]<=H[j]:
            flag=0
    l[i]=flag
print(sum(l))
from collections import defaultdict   
def C():
    N, M = map(int, input().split())
    H = [int(n) for n in input().split()]
    isGood = [True for i in range(len(H))]
    for i in range(M):
        A, B = map(int, input().split())
        if H[A-1] >= H[B-1]:
            isGood[B-1] = False
        if H[B-1] >= H[A-1]:
            isGood[A-1] = False
    count = 0
    for b in isGood:
        if b:
            count += 1
    print(count)

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

LL = []
for i in range(M):
    a,b = map(int, input().split())
    if H[a-1] > H[b-1]:
        LL.append(b)
    elif H[a-1] < H[b-1]:
        LL.append(a)
    elif H[a-1] == H[b-1]:
        LL.append(a)
        LL.append(b)

LLS = set(LL)
print(N-len(LLS))
N, M = map(int, input().split())
H = list(map(int, input().split()))

edges = [[] for _ in range(N)]
for _ in range(M):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

ans = 0
for i, h in enumerate(H):
    mx = 0
    for to in edges[i]:
        mx = max(mx, H[to])
    if mx < h:
        ans += 1

print(ans)
n, m = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

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

cnt = 0

for i, lst in enumerate(road):
	for j in lst:
		if H[i] <= H[j]:
			break
	else:
		cnt += 1

print(cnt)
def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = [[] for _ in range(N)]
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp].append(H[ss])
        A[ss].append(H[pp])

    ans = 0
    for j in range(N):
        now = H[j]
        if not A[j] or now > max(A[j]):
            ans += 1

    print(ans)


resolve()
N, M = map(int, input().split())
H = list(map(int, input().split()))
bad = []
for _ in range(M):
    i, j = map(int, input().split())
    if H[i-1] <= H[j-1]:
        bad.append(i)
    if H[i-1] >= H[j-1]:
        bad.append(j)
print(N-len(set(bad)))
date0=input().rstrip().split(" ")
N=int(date0[0])
M=int(date0[1])
date1=input().rstrip().split(" ")
list0=[]
for i in range(N):
    list0.append(0)
for j in range(M):
    date=input().rstrip().split(" ")
    A=int(date[0])
    B=int(date[1])
    if int(date1[A-1])==int(date1[B-1]):
        list0[A-1]=1
        list0[B-1]=1
    elif int(date1[A-1])>int(date1[B-1]):
        list0[B-1]=1
    else:
        list0[A-1]=1
print(list0.count(0))
N,M = map(int,input().split())
H = [0]
H.extend(list(map(int,input().split())))

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

ans = N

# print(H)
# print(R)

for i in range(1,N+1):
  for j in R[i]:
    if H[i] <= H[j]:
      ans = ans - 1
      break


print(ans)
n,m = map(int,input().split())
h = list(map(int,input().split()))
out = [1 for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  if h[a] <= h[b]:
    out[a] = 0
  if h[a] >= h[b]:
    out[b] = 0
#print(out)
print(sum(out))
N, M =list(map(int, input().split()))
H = [0] + list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]

is_good = [1 for i in range(N+1)]
for i in range(M):
  a,b = AB[i]
  if H[a] >= H[b]:
    is_good[b] = 0
  if H[a] <= H[b]:
    is_good[a] = 0

cnt = 0
for i in range(1, N+1):
  if is_good[i] == 1:
    cnt+=1
print(cnt)
n,m=map(int, input().split())
H = list(map(int, input().split()))
es=[[] for i in range(n)]
for i in range(m):
    a,b=map(int, input().split())
    if H[a-1]<=H[b-1]:
        es[a-1].append(b-1)
    if H[b-1]<=H[a-1]:
        es[b-1].append(a-1)
cnt=0
for e in es:
    if e==[]:
        cnt+=1
print(cnt)
from collections import deque
n, m = map(int, input().split())
h = [int(x) for x in input().split()]

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

ans = 0
for i in range(n):
  judge = True
  for v in tree[i]:
    if h[i] <= h[v]:
      judge = False
  if judge:
    ans += 1

print(ans)
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = n
t = [1]*n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if t[a] and h[a] <= h[b]:
        t[a] = 0
        ans -= 1
    if t[b] and h[b] <= h[a]:
        t[b] = 0
        ans -= 1
print(ans)
n,m=map(int, input().split())
h=list(map(int,input().split()))
nl=[1]*n

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

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

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

ans = 0
for i in range(n):
    high = True
    for to in eg[i]:
        if h[i] <= h[to]:
            high = False
    if high:
        ans += 1
print(ans)
n,m= map(int, input().split())
h=list(map(int, input().split()))
B=[0]*m
A=[0]*m
t=[[] for i in range((n+1))]
an=0
for i in range(m):
    A[i],B[i] = list(map(int, input().split()))

for i in range(m):
    t[A[i]].append(B[i])
    t[B[i]].append(A[i])
for i in range(1,n+1):
    k=0
    for j in range(len(t[i])):
        if h[i-1]<=h[t[i][j]-1]:
            k=1
    if k==0:
        an+=1

print(an)
N,M = map(int,input().split())
tower = list(map(int,input().split()))
road = [list(map(int,input().split())) for i in range(M)]
aa = ['.']*N
for i in road:
  if tower[i[0]-1] > tower[i[1]-1]:
    aa[i[1]-1] = 'v'
  elif tower[i[0]-1] == tower[i[1]-1]:
    aa[i[0]-1] = aa[i[1]-1] = 'v'
  else:
    aa[i[0]-1] = 'v'
print(aa.count('.'))
from sys import stdin,stdout
from collections import defaultdict
n,e=list(map(int,stdin.readline().split()))
h=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for _ in range(e):
    a,b=map(int,stdin.readline().split())
    g[a]+=[b]
    g[b]+=[a]
ans=0
for cur in range(1,n+1):
    f=1
    for neigh in g[cur]:
        if h[neigh-1]>=h[cur-1]:
            f=0
            break
    if f:ans+=1
print(ans)
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))
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
adjL = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    adjL[a].append(b)
    adjL[b].append(a)

ans = 0
for v in range(N):
    for v2 in adjL[v]:
        if Hs[v] <= Hs[v2]:
            break
    else:
        ans += 1

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

road_list = []
for _ in range(N):
    road_list.append([])
    
for i in range(M):
    a, b = list(map(int, input().split()))
    
    H_a, H_b = [H_list[a - 1], H_list[b - 1]]
    
    if H_a <= H_b:
        road_list[a - 1].append(b)

    if H_b <= H_a:
        road_list[b - 1].append(a)

ans = 0
for road in road_list:
    if len(road) == 0:
        ans += 1
print(ans)
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for _ in range(m):
  a,b=map(int,input().split())
  if ans[a-1]:
    if h[a-1]<=h[b-1]:
      ans[a-1]=0
  if ans[b-1]:
    if h[b-1]<=h[a-1]:
      ans[b-1]=0
print(ans.count(1))
N, M = map(int, input().split())
H = list(map(int, input().split()))
A, B = [], []
ans = [1]*N
for _ in range(M):
    a, b = map(int, input().split())
    if H[a-1] < H[b-1]:
        ans[a-1] = 0
    elif H[a-1] > H[b-1]:
        ans[b-1] = 0
    else:
        ans[a-1] = 0
        ans[b-1] = 0
print(ans.count(1))
N, M = map(int, input().split())
H = list(map(int, input().split()))
flag = [True]*N
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] <= H[B]:
        flag[A] = False
    if H[B] <= H[A]:
        flag[B] = False
ans = 0
for i in range(N):
    if flag[i]:
        ans += 1
print(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[B] = 0
    elif H[A] == H[B]:
        L[A] = 0
        L[B] = 0
    else:
        L[A] = 0

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

check = [True] * n #小さかったらfalseに
for i in range(m):
    #print(i)
    a,b = (map(int,input().split()))
    if h[a-1] > h[b-1]:
        check[b-1] = False
    elif h[a-1] < h[b-1]:
       # print("i,check",i,check)
        check[a-1] = False
    else:
        check[a-1] = False
        check[b-1] = False
print(sum(check))
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = [1]*n
for _ in range(m):
    a, b = map(int, input().split())
    a = a - 1
    b = b-1
    if (h[a] < h[b]):
        p[a] = 0
    elif (h[a] > h[b]):
        p[b] = 0
    else:
        p[a] = 0
        p[b] = 0
print(sum(p))
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 i in range(N):
  is_good = True
  for j in G[i]:
    if H[j] >= H[i]:
      is_good = False
      break
  if is_good:
    ans += 1

print(ans)
N,M=map(int,input().split())
H=[int(x) for x in input().split()]
l=[1 for _ in range(N)]
for _ in range(M):
  A,B=map(int,input().split())
  if H[A-1] < H[B-1]:
    l[A-1] = 0
  elif H[A-1] == H[B-1]:
    l[A-1] = 0
    l[B-1] = 0
  else:
    l[B-1] = 0
print(sum(l))
N,M = map(int,input().split())
H = list(map(int,input().split()))
adj = [ [] for _ in range(N) ]
for _ in range(M):
  u,v = map(int,input().split())
  u -= 1
  v -= 1
  adj[u].append(v)
  adj[v].append(u)

res = 0
for i in range(N):
   if all([ H[n] < H[i] for n in adj[i]]):
    res += 1

print(res)
n, m = map(int, input().split())
h_list = list(map(int, input().split()))
m_dic = {}
for i in range(1, n+1):
    m_dic[i] = []
for i in range(m):
    a, b = map(int, input().split())
    m_dic[a].append(b)
    m_dic[b].append(a)

ans = 0
for i in range(1, n+1):
    good = True
    for j in m_dic[i]:
        if h_list[i-1] <= h_list[j-1]:
            good = False
            break
    if good: ans += 1
print(ans)
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=0
l=[[] for i in range(n+1)]
for j in range(m):
  a,b=map(int,input().split())
  l[a].append(b)
  l[b].append(a)

for i in range(1,n+1):
  now=l[i]
  o=0
  for j in now:
    if h[i-1]>h[j-1]:
      o+=1
  if o==len(now):
    ans+=1
print(ans)
n,m = map(int,input().split())
H = list(map(int,input().split()))
D=[]
for i in range(m):
    A,B = map(int,input().split())
    if H[A-1]<H[B-1]:
        D.append(A)
    elif H[A-1]==H[B-1]:
        D.append(A)
        D.append(B)
    else:
        D.append(B)
ans = list(set(list(range(1,n+1)))-set(D))
print(len(ans))
from collections import defaultdict
n, m = map(int, input().split())
ns = list(map(int, input().split()))
ns = [0] + ns
dic = defaultdict(list)
for i in range(m):
    a, b = map(int, input().split())
    dic[a].append(b)
    dic[b].append(a)
cnt = 0
for i in range(1, n+1):
    if dic[i]:
        if ns[i] > max(ns[j] for j in dic[i]):
            cnt += 1
    else:
        cnt += 1
print(cnt)
n, m = map(int, input().split())
H = [0] + list(map(int, input().split()))
graph = {i: set() for i in range(1, n + 1)}

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

ans = 0
for v in range(1, n + 1):
    orig_h = H[v]
    for nv in graph[v]:
        if orig_h <= H[nv]:
            break
    else:
        ans += 1
print(ans)
#!/usr/bin/env python3
N, M = [int(str) for str in input().strip().split()]
H = [int(str) for str in input().strip().split()]
AB = [[int(str) - 1 for str in input().strip().split()] for _ in range(M)]


def solve():
    G = [0] * N
    for a, b in AB:
        G[a] = max(G[a], H[b])
        G[b] = max(G[b], H[a])

    ans = 0
    for i in range(N):
        if H[i] > G[i]:
            ans += 1

    print(ans)


solve()
n,m = map(int, input().split())
h = list(map(int, input().split()))
graph = [[] for i in range(n)]
count = 0
for i in range(m):
    x,y = map(int, input().split())
    graph[x-1].append(y-1)
    graph[y-1].append(x-1)
for i in range(n):
    yoi = True
    for j in graph[i]:
        if h[i] >h[j]:
            pass
        else:
            yoi = False
            break
    if yoi:
        count += 1
print(count)
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  if h[a]>h[b]:ans[b]=0
  elif h[a]<h[b]:ans[a]=0
  elif h[a]==h[b]:ans[a]=ans[b]=0
print(ans.count(1))
n, m = map(int, input().split())
ht = list(map(int, input().split()))
rd = [list(map(int, input().split())) for _ in range(m)]
flg = [1] * n
for i in rd:
    if ht[i[0]-1] <= ht[i[1]-1]:
        flg[i[0]-1] = 0
    if ht[i[0]-1] >= ht[i[1]-1]:
        flg[i[1]-1] = 0
print(sum(flg))
n, m = map(int, input().split())
h = list(map(int, input().split()))
comp = [] 
for x in h:
    comp.append([x, [0]])
# print(comp)
for j in range(m):
    a, b = map(int, input().split())
    comp[a-1][1].append(comp[b-1][0])
    comp[b-1][1].append(comp[a-1][0])
# print(comp)
count = 0
for y in comp:
    if y[0] > max(y[1]):
        count += 1
print(count)
n,m = map(int, input().split())
h = list(map(int, input().split()))
n = [1 for i in range(n)]
for i in range(m):
    a,b =  map(int, input().split())
    if h[a-1] > h[b-1]:
        n[b-1]=0
    elif h[a-1]<h[b-1]:
        n[a-1]=0
    else:
        n[a-1]=0
        n[b-1]=0
print(sum(n))
#!/usr/bin/env python3
# coding: utf-8

def main():
    N, M = map(int, input().split())
    H = dict(zip(range(1, N + 1), map(int, input().split())))
    m = dict(zip(range(1, N + 1), [[0] for _ in range(N)]))
    for _ in range(M):
        A, B = map(int, input().split())
        m[A].append(H[B])
        m[B].append(H[A])
    c = 0
    for k, v in m.items():
        if H[k] > max(v):
            c += 1
    print(c)

if __name__ == "__main__":
    main()
N,M = map(int, input().split())
H = list(map(int, input().split()))
P = [1]*N
for i in range(M):
  A,B = map(int, input().split())
  if H[A-1]<=H[B-1]:
    P[A-1]=0
  if H[A-1]>=H[B-1]:
    P[B-1]=0
print(sum(P))
N, M = map(int, input().split())
H = list(map(int, input().split()))
connected = [list() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    connected[a-1].append(H[b-1])
    connected[b-1].append(H[a-1])

result = 0
for i, c in enumerate(connected):
    if len(c) == 0 or H[i] > max(c):
        result += 1
print(result)
def f(heights,roads):
	count, r =0, [True] * len(heights)
	for u,v in roads:
		if heights[u-1] <= heights[v-1]: r[u-1] = False
		if heights[u-1] >= heights[v-1]:r[v-1] = False
	for b in r:
		count += 1 if b else 0
	return count

n,m = map(int, raw_input().split(' '))
print f(map(int,raw_input().split(' ')), [map(int, raw_input().split(' ')) for _ in range(m)] )