peterverebics/CodeNet_Python_118 huggingface dataset:
n,m = map(int,input().split())
H = [int(i) for i in input().split()]

a = [0] * m
b = [0] * m

ans = [1]* n



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


for j in range(m):
    if H[a[j]-1] < H[b[j]-1]:
        ans[a[j]-1] = 0
    else:
        ans[b[j]-1] = 0


print(ans.count(1))
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
    if a <= b:
        l[a] = 0

print(sum(l))
from collections import defaultdict
N,M = map(int, input().split())
Hs = list(map(int, input().split(" ")))

edges = [defaultdict(int) for _ in range(N+1)]
for i in range(M):
    A,B = map(int, input().split(" "))
    edges[A][B] += 1
    edges[B][A] += 1

ans = 0
for i,e in enumerate(edges):
    if e == {}:
        continue
    good = True
    for neightboor in e.keys():
        if Hs[neightboor - 1] > Hs[i -1]:
            good = False
    if good == True:
        print(i, e)
        ans += 1

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

par = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    if A>B:
        par[A-1] = 1
    else:
        par[B-1] = 1

print(N-sum(par))
N, M = map(int, input().split())
H  = list(map(int, input().split()))
ans_pin = [1] * N
for i in range(M):
  A, B = map(int, input().split())
  if H[A -1] < H[B-1] :
    ans_pin[A-1] = 0
  else:
    ans_pin[B-1] = 0
print(sum(ans_pin))
def q3():
    N, M = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    ans = [True]*N

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

        if H[A-1] <= H[B-1]:
            ans[A-1] = False
        if H[B-1] <= H[A-1]:
            ans[B-1] = False

    print(ans)


if __name__ == '__main__':
    q3()
import collections
N,M=map(int,input().split())
H=input().split()
tenboudai=[i for i in range(1,N+1)]
lose=[]
for i in range(M):
    X=input().split()
    A=int(X[0])
    B=int(X[1])
    if H[A-1]>H[B-1]:
        lose.append(B)
    elif H[A-1]<H[B-1]:
        lose.append(A)
    elif H[A-1]==H[B-1]:
        lose.append(A)
        lose.append(B)
    
a=len(tenboudai)
b=len(collections.Counter(lose))

print(a-b)
N, M = map(int, input().split())
H = input().split()
list_h = [int(n) for n in H]
list_a = []
list_b = []
MAX_A = []

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

for j in range(M):
    a = list_a[j]
    b = list_b[j]
    MAX = max(list_h[a-1], list_h[b-1])
    MAX_A.append(MAX)

MAX_A = set(MAX_A)
print(len(MAX_A))
n,m=map(int,input().split())
H=list(map(int,input().split()))
c=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    if H[a-1]<=H[b-1]:
        c[a-1]+=1
    elif H[b-1]<=H[a-1]:
        c[b-1]+=1
x=0
for y in c:
    if y==0:
        x+=1

print(x)
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0]*m
b = [0]*m
for i in range(m):
    a[i],b[i] = map(int,input().split())
s = [0]*m
count = 0
sw = [0]*n
for i in range(m):
    if  h[a[i]-1] >= h[b[i]-1] and sw[a[i]-1] == 0:
        count += 1
        sw[a[i]-1] = 1
    elif h[a[i]-1] < h[b[i]-1] and sw[b[i]-1] == 0:
        count += 1
        sw[b[i]-1] = 1
print(count)
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
d=[ [] for i in range(n+1)]
for i in range(m):
  #a=ab[i][0]
  #b=ab[i][1]
  d[ab[i][0]].append(h[ab[i][1]-1])
  d[ab[i][1]].append(h[ab[i][0]-1])
count=0
for i in range(1,len(d)-1):
  if len(d[i])!=0 and h[i]<max(d[i]):
    count+=1
print(count)
n,m = map(int,input().split())

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

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

good = [1] * (n+1)


for i in a:
    if h[i[0]-1] < h[i[1]-1]:
        good[i[0]] = 0
    else:
        good[i[1]] = 0

print(good.count(1)-1)
from sys import stdin
from collections import defaultdict
N,M = [int(x) for x in stdin.readline().rstrip().split()]
H = [int(x) for x in stdin.readline().rstrip().split()]
d = defaultdict(set)
for i in range(M):
    A,B = [int(x) for x in stdin.readline().rstrip().split()]
    d[A].add(B)
    d[B].add(A)
    
ans = 0
for h in range(1,N+1):
    f = True
    for i in d[h]:
        if H[i-1] > H[h-1]:
            f = False
    if f:
        ans += 1
print(ans)
N, M = map(int, input().split())
H = list(map(int, input().split()))
good = set(range(N))
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    if H[a] <= H[b]:
        good -= {a}
    if H[a] == H[b]:
        good -= {b}
print(len(good))
n, m = map(int, input().split())
hyoukou = list(map(int, input().split()))
roots = [map(int, input().split()) for i in range(m)]

l = []

for a, b in roots:
  if hyoukou[a-1] >= hyoukou[b-1]:
    l.append(b)
      
  if hyoukou[b-1] >= hyoukou[a-1]:
    l.append(a)
      
print(len(set(l)))
n, m = map(int, input().split())
H = list(map(int, input().split()))
X=[[0] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  X[a-1].append(b)
  X[b-1].append(a)
t=0
for i in range(n):
  E=list(H[k-1] for k in X[i])
  if max(E) < H[i]:
    t+=1
print(t)
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
  h[min(ab[i][0], ab[i][1])-1] = 0
  if h[ab[i][0]-1] == h[ab[i][1]-1]: h[ab[i][0]-1] = h[ab[i][1]-1] = 0
h = [i for i in h if i != 0]
print(len(h))
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = map(int,input().split())
max_h = []
li = []
for i in range(m):
    max_h.append(max(h[a[i]-1],h[b[i]-1]))
    li.append(a[i])
    li.append(b[i])
print( len(set(max_h))+ len(set(h)) - len(set(li)))
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
d=[ [] for i in range(n+1)]
for i in range(m):
  #a=ab[i][0]
  #b=ab[i][1]
  d[ab[i][0]].append(h[ab[i][1]-1])
  d[ab[i][1]].append(h[ab[i][0]-1])
count=0
d.pop(0)
for i in range(0,len(d)):
  if len(d[i])==0:
    count+=1
  elif h[i]<max(d[i]):
    count+=1
print(count)
n, m = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
c = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split(' '))
    c[a - 1].append(b - 1)
    c[b - 1].append(a - 1)
r = 0
for i in range(n):
    mh = 1
    for j in c[i]:
        mh = h[j] if mh < h[j] else mh
    r += 1 if h[i] > mh or len([i]) == 0 else 0
print(r)
from itertools import chain

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

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

count = 0

for i in range(1, n+1):

    c= []
    e= []
    for j in ab:
        if i in j:
            c.append(j)
    d =list(chain.from_iterable(c))

    for k in d:
        e.append(H[k-1])

    if len(e)==0:

        continue
    elif max(e) == H[i-1]:
        count += 1

print(count)
N, M, *I = map(int, open(0).read().split())
H, AB = [0] + I[:N], I[N:]

memo = [False] + [True] * N
for a, b in zip(*[iter(AB)] * 2):
    if H[a] < H[b]:
        memo[a] = False
    else:
        memo[b] = False

print(sum(memo))
import numpy as np

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

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

print(np.sum(ans == 1))
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
ab = [[] for _ in range(n+1)]
count = 0
for i in range(m):
  a, b = map(int, input().split())
  ab[a].append(b)
  ab[b].append(a)

for j in range(1,n+1):
  for k in ab[j]:
    if h[j] <= h[k]:
      break
    else:  
      count += 1
      
print(count)
#!/usr/bin/env python3
n, m = map(int, input().split())
*h, = map(int, input().split())
h = [0] + h
i = [0] + [1] * n

for j in range(m):
    a, b = map(int, input().split())
    if h[a] >= h[b]:
        i[b] = 0
    elif h[a] <= h[b]:
        i[a] = 0
print(sum(i))
n,m = map(int,input().split(" "))
h = list(map(int,input().split(" ")))
high = []
low = []
better = 0
for i in range(m):
  a,b = map(int,input().split(" "))
  if h[a-1] > h[b-1]:
    high.append(a)
  else:
    low.append(a)
print(n-len(set(low)))
N, M = map(int, input().split())
Height = [int(i) for i in input().split()]

count = 0
for _ in range(M):
    A, B = map(int, input().split())
    if min(Height[A - 1], Height[B - 1]) != 0:
        count += 1
    Height[A - 1], Height[B - 1] = 0, 0

for i in Height:
    if i != 0:
        count += 1

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

good = 0

obs = [[]*n]

for i in range(m):
    a, b = map(int, input().split())
n,m = [int(e) for e in input().split()]
h = [int(e) for e in input().split()]
a=[0]*m
b=[0]*m
for i in range(m):
    a[i],b[i] = [int(e) for e in input().split()]
res = 0
no = set()
for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        no.add(a[i])
    elif h[a[i]-1] < h[b[i]-1]:
        no.add(b[i])
    else:
        no.add(b[i])
        no.add(a[i])
print(n-len(no))
n,m=list(map(int, input().split()))
dic={}
h=list(map(int, input().split()))
for i in range(m):
  a,b=list(map(int, input().split()))
  a-=1
  b-=1
  
  if h[a]>h[b]:
    dic[a]=True
    dic[b]=False
  if h[b]>h[a]:
    dic[b]=True 
    dic[a]=False
  if h[b]==h[a]:
    dic[b]=False
    dic[a]=False
  #print(dic)
ct=0
for i in range(n):
  if i not in dic:
    ct+=1
print(list(dic.values()).count(True)+ct)
n,m = map(int,input().split())

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

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

good = [1] * (n+1)


for i in a:
    if h[i[0]-1] < h[i[1]-1]:
        good[i[0]] = 0
    elif h[i[0]-1] > h[i[1]-1]:
        good[i[1]] = 0
    else:
        continue

print(good.count(1)-1)
import collections
n,m=map(int,input().split())
H=list(map(int,input().split()))
blacklist=[]
for i in range(m):
    a,b=map(int,input().split())
    Ha,Hb=H[a-1],H[b-1]
    if Ha<Hb:
        blacklist.append(a)
    else:
        blacklist.append(b)
ans=0
cbl=collections.Counter(blacklist)
for j in range(1,n+1):
    if cbl[j]==0:
        ans+=1
print(ans)
# データ入力
N,M = map(int,input().split())
H = [int(i) for i in input().split()]

# 山のインデックスリスト
good = {i for i in range(1,N+1)}

for m in range(M):
    # 山の経路の入力
    a,b = [int(i) for i in input().split()]
    if H[a-1]>=H[b-1]:
        good = good - {b}
    elif H[a-1]<=H[b-1]:
        good = good - {a}

print(len(good))
from collections import defaultdict
n,m = map(int,input().split())
h_list = list(map(int,input().split()))
connect_dic = defaultdict(set)
for i in range(m):
    a,b = map(int,input().split())
    connect_dic[a].add(b)
    connect_dic[b].add(a)

count = 0
for k,v in connect_dic.items():
    if h_list[k-1]>=max([h_list[num-1] for num in v]):
        count += 1

print(count)
n, m = map(int, input().split())
hlst = list(map(int, input().split()))
lst = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    lst[a].append(hlst[b]-1)
    lst[b].append(hlst[a]-1)
i = 0

for _ in range(n):
  if sum([o for o in lst[_] if o > _]) == 0:
    i += 1
print(i)
N,M=map(int,input().split())
H=list(map(int,input().split()))
roads = []
for i in range(M):
    roads.append(list(map(int,input().split())))
    
for road in roads:
    x = min(road[0],road[1])
    if x in H:
        H.remove(x)
    
print(len(H))
N,M = map(int,input().split())
H = list(map(int,input().split()))
c = [0] * N
for i in range(M):
    A,B = map(int,input().split())
    if A >= B:
        c[B - 1] += 1
    if B >= A:
        c[A - 1] += 1
print(c.count(0))
n, m = map(int, input().split())
list_height = list(map(int, input().split()))
list_way = []
list_goodpoint = [1]*n
for i in range(m):
  list_way.append(list(map(int, input().split())))

for way in list_way:
  if way[0] == way[1]:
    list_goodpoint[way[0]-1] = 0
    list_goodpoint[way[1]-1] = 0
  if way[0] > way[1]:
    list_goodpoint[way[1]-1] = 0
  if way[0] < way[1]:
    list_goodpoint[way[0]-1] = 0
print(sum(list_goodpoint))
N,K = map(int,input().split())
input()
outs = [1] * N
for _ in range(K):
    a,b = map(int,input().split())
    if outs[a-1] == 0 or outs[b-1] == 0:
        continue
    else:
        outs[b-1] = 0
print(sum(outs))
N,M=map(int,input().split())
H=list(map(int,input().split()))
l=list()
for i in range(M):
  A,B=map(int,input().split())
  if H[A-1]==H[B-1]:
    l.append('a')
  else:
    bad=(min(H[A-1],H[B-1]))
    l.append(bad)
  
minus=(len(set(l)))
h=len(H)
print(h-minus)
n,m=map(int,input().split())
h=[int(i)for i in input().split()]
j=[list(map(int,input().split())) for i in range(m)]
c=0
d=0
for z in range(n):
    d=0
    for s in range(m):
        if h[z]in j[s]:
            d=1
            if min(j[s])!=h[z]:
                c+=1
                break
    if d==0:
        c+=1
print(c)
n, m = list(map(int, input().split()))

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

yoi_warui = [0]*(n)
dokuritsu = [0]*(n)

for i in range(m):
    a, b = list(map(int, input().split()))
    dokuritsu[a-1] = 1
    dokuritsu[b-1] = 1
    if h[a-1] < h[b-1]:
        yoi_warui[a-1] = 1
    elif h[b-1] < h[a-1]:
        yoi_warui[b-1] = 1

print(yoi_warui.count(0)- dokuritsu.count(0))
n, m = map(int, input().split())
p = []
lst = list(map(int, input().split()))
lst1 = [input().split() for _ in range(m)]
for i in range(m):
    p.append(max(lst1[i][0],lst1[i][1]))
print(len(set(p)))
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
    else:
        L[A-1]=0
AAA=sum(L)
print(AAA)
import collections
import sys
input = lambda: sys.stdin.readline().strip()

def main():
    N,M = map(int,input().split())
    H_list = sorted(list(map(int,input().split())))
    ab_list = [map(int,input().split()) for _ in range(M)]

    min_set = set()
    for a,b in ab_list:
        min_set.add(min(a,b))
    c = collections.Counter(H_list)

    ans = 0
    for i in min_set:
        ans += c[i]
    print(ans)

main()
N,M= list(map(int, input().split())) 
H = list(map(int, input().split())) 
A = [0]*M
B = [0]*M
for i in range(M):
    A[i], B[i]= map(int, input().split())
ans = set([])
for i in range(M):
    a = A[i]-1
    b = B[i]-1
    if H[a] <= H[b]:
        ans.add(B[i])
    else:
        ans.add(A[i])
print(len(ans))
N,M = map(int, input().split())

goodObservatory = [1]*N

H = input().split()

for i in range(M):
	A,B = map(int, input().split())
	if H[A-1] > H[B-1]:
		goodObservatory[B-1] = 0
	elif H[A-1] < H[B-1]:
		goodObservatory[A-1] = 0
	elif H[A-1] == H[B-1]:
		goodObservatory[A-1] = 0
		goodObservatory[B-1] = 0

print(sum(goodObservatory))
n, m = input().split()
h = input().split()
ten = [0]*int(n)
for i in range(int(m)):
    l = input().split()
    if h[int(l[0])-1] >= h[int(l[1])-1]:
        ten[int(l[1])-1] =1
    if h[int(l[0])-1] <= h[int(l[1])-1]:
        ten[int(l[0])-1] =1
print(ten.count(0))
n,m=input().split()
h_list = []
h_list = input().split(" ")
result =[True]*int(n)
count = 0
for i in range(int(m)):
    temp1,temp2=input().split()
    if h_list[int(temp1)-1] < h_list[int(temp2)-1]:
        result[int(temp1)-1] = False
    elif h_list[int(temp1)-1] == h_list[int(temp2)-1]:
        result[int(temp1) - 1] = False
        result[int(temp2) - 1] = False
    else:
        result[int(temp2)-1] = False
for i in range(int(n)):
    if(result[i]==True):
        count += 1
print(count)
n,m=map(int,input().split())
h=list(map(int,input().split()))
l = list(range(1,n+1))
for _ in range(m):
    x = list(map(int, input().split()))
    if h[x[0]-1] < h[x[1]-1]:
        if x[0] in l:
            l.remove(x[0])
    else:
        if x[1] in l:
            l.remove(x[1])
print(len(l))
N, M = map(int, input().split())
H = list(map(int, input().split()))
C = [1]*(N)
for i in range(M):
  a, b = map(int, input().split())
  if H[a-1] >= H[b-1]:
    H[b-1] = 0
  if H[b-1] >= H[a-1]:
    H[a-1] = 0
print(sum(C))
n, m = map(int, input().split())
Hn = list(map(int, input().split()))
abn = [list(map(int, input().split())) for _ in range(m)]
pool = [[h] for h in Hn]
for ab in abn:
    pool[ab[0]-1].append(Hn[ab[1]-1])
    pool[ab[1]-1].append(Hn[ab[0]-1])
ans = 0
for i in range(n):
    if len(pool[i]) == 1:
        ans += 1
    else:
        if max(pool[i]) == Hn[i] and max(pool[i]) > min(pool[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
    else:
        l[b - 1] = 0
print(sum(l))
n,m=map(int,input().split())
h=list(map(int,input().split()))

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

ans=[0]*n

count =[[h[i]] for i in range(n)]
#print(count) 
for i in range(m):
    count[ab[i][0]-1].append(h[ab[i][1]-1])
    count[ab[i][1]-1].append(h[ab[i][0]-1])
#print(count)
ans=[]
for i in range(n):
    if h[i]==max(count[i]) and count[i].count(h[i])==1:
        ans.append(max(count[i]))
#print(ans)
print(len(set(ans)))
if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    H = list(map(int, input().split()))
    good_obs = [True for i in range(N)]
    for i in range(M):
        a, b = list(map(int, input().split()))
        if H[a-1] >= H[b-1]:
            good_obs[b-1] = False
        elif H[a-1] <= H[b-1]:
            good_obs[a-1] = False
    print(sum(good_obs))
N, M = map(int, input().split())
H = list(map(int, input().split()))
ma = [0]*N

for i in range(M):
    a, b = map(int, input().split())
    ma[a-1] = max(ma[a-1], H[b-1])
    ma[b-1] = max(ma[b-1], H[a-1])
ans = 0
for i in range(1, N):
    if ma[i] < H[i]:
        ans += 1
print(ans)
n, m = map(int, input().split())
l = [1] * (n + 1)
l[0] = 0 
h = list(map(int, input().strip().split())) 
b_a, b_b = [0, 0]
for i in range(m):
  a, b = map(int, input().split())
  if b_a == a and b_b == b :
    l[a] = l[b] = 0
  if h[a-1] < h[b-1]:
    l[a] = 0
  else :
    l[b] = 0
  b_a = a
  b_b = b

print(sum(l))
N, M = map(int, input().split())
H = list(map(int, input().split()))
G = [[0]*N for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    G[A-1][B-1] = 1
    G[B-1][A-1] = 1

cnt = 0
for i in range(N):
    flag = False
    for j in range(N):
        if G[i][j] == 1:
            if H[i] < H[j]:
                break
            else:
                flag = True
    if flag:
        cnt += 1

print(cnt)
N,M = map(int,input().split())
list_H = input().split()
list_N=list(range(1,N+1))
for i in range(M):
  A,B = map(int,input().split())
  if list_H[A-1]<list_H[B-1]:
    list_N[A-1]=0
  if list_H[A-1]>list_H[B-1]:
    list_N[B-1]=0
  if list_H[A-1]==list_H[B-1]:
    list_N[A-1]=0
    list_N[B-1]=0
num=0
for i in range(N):
  if list_N[i]!=0:
    print(list_H[i])
    num=num+1
#print(num)
import os

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

if __name__ == "__main__":
	main()
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

good = set()
for i in range(m):
    good.add(max(h[a[i]-1], h[b[i]-1]))
    
print(len(good))
n, m = map(int, input().split())
H = list(map(int, input().split()))
road = [0 for i in range(m)]
ans = [0] * n

for i in range(m):
    road[i] = list(map(int, input().split()))

for j in range(m):
    if H[road[j][0]-1] <= H[road[j][1]-1]:
        ans[road[j][0]-1] = 1

total = sum(ans)
print(n-total)
from operator import itemgetter
n,m = map(int,input().split())
h = list(map(int,input().split()))
cnt = 0
st = [list(map(int,input().split())) for i in range(m)]
graph = [False]*n
tansakuzumi = []
for i,j in st:
    if h[i-1] > h[j-1]:
        graph[i-1] = True
    elif h[i-1] <= h[j-1]:
        graph[j-1] = True
for i in graph:
    if i:
        cnt += 1
print(cnt)
n, m = map(int, input().split())
h = [int(i) for i in input().split()]
load = [list(map(int, input().split())) for _ in range(m)]
result = {i: 1 for i in range(n)}

for l in load:
    a, b = l[0] - 1, l[1] - 1
    if h[a] < h[b]:
        result[a] = 0
    elif h[a] > h[b]:
        result[b] = 0
    elif h[a] == h[b]:
        result[a] = 0
        result[b] = 1

print(sum(result.values()))
from operator import mul
n, m = map(int, input().split())
h = list(map(int, input().split()))

array = [[0 for i in range(n)] for i in range(n)]
for i in range(m):
  a, b= map(int, input().split())
  array[a-1][b-1] = 1
  array[b-1][a-1] = 1
route = [[sum(map(mul, row, col)) for col in zip(*array)] for row in array]

ans = 0
for i in range(n):
  flag = True
  for j in range(n):
    if route[i][j] > 0 and (h[i] < h[j]):
      flag = False
      break
  if flag:
    ans+=1
print(ans)
n, m = map(int, input().split())
h = list(map(int, input().split()))

ans = set()
for _ in range(m):
    a, b = map(int, input().split())
    s1, s2 = h[a - 1], h[b - 1]
    ans |= {a} if s1 < s2 else {b}

print(n - len(ans))
N,M=map(int,input().split())
H=list(map(int,input().split()))
bad=[]
for k in range(M):
  A,B=map(int,input().split())
  if H[A-1]<H[B-1]:
    bad.append(A-1)
  elif H[A-1]<H[B-1]:
    bad.append(A-1 and B-1)
  else:
    bad.append(B-1)
print(N-len(set(bad)))
N, K = map(int, input().split())

H = input().split()
H2 = [0] * N
for i in range(K):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        H2[b-1] = 1
    elif H[a-1] < H[b-1]:
        H2[a-1] = 1
    elif H[a-1] == H[b-1]:
        H2[b-1] = 1
        H2[a-1] = 1

count = 0
for i in H2:
    if i == 0:
        count+=1
print(count, end = "")
import os

def main():
	n,m = map(int, input().split())
	h_list = list(map(int, input().split()))
	ans = [1]*n
	result = []
	for i in range(m):
		a,b = map(int, input().split())
		if h_list[a-1] < h_list[b-1]:
			ans[a-1] = 0	
		else:
			ans[b-1] = 0
		result.append(a)
		result.append(b)
	result_set = set(result)
	count = 1
	for i in result_set:
		if count == i:
			pass
		else:
			ans[i-1] = 0		
			count = i -1
		count += 1
	print(sum(ans))			

if __name__ == "__main__":
	main()
N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
list = []
for i in range(M):
  if H[A[i]-1]>=H[B[i]-1]:
    list.append(B[i])
  else:
    list.append(A[i]-1)
print(N-len(set(list)))
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)

# 1 ✕ N
N, M = list(map(int, input().rstrip().split()))

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

A = tuple(map(int, input().rstrip().split()) for _ in range(M))


items = dict((i + 1, []) for i in range(N))

for k, v in A:
    items[k].append(v)
    items[v].append(k)

ans = 0
for i in range(N):
    if len(list(filter(lambda x: H[i] >= x, items[i + 1]))) == 0:
        ans += 1

print(ans)
def c166(n, m, hl, abli):

    flag = [True]*n

    for i in abli:
        if hl[i[0]-1] < hl[i[1]-1]:
            flag[i[0]-1] = False
        else:
            flag[i[1]-1] = False

    ans = flag.count(True)
    return ans

def main():
    n, m = map(int, input().split())
    hl = list(map(int, input().split()))
    abli = [list(map(int, input().split()))for i in range(m)]
    print(c166(n, m, hl, abli))

if __name__ == '__main__':
    main()
n, m = map(int, input().split())
h = [int(i) for i in input().split()]

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

result = {i: 0 for i in range(n)}

for l in load:
    a, b = l[0]-1, l[1]-1
    #print(a,b)
    if h[a] < h[b]:
        result[b] += 1

#print(result)
print(sum(result.values()))
n, m = map(int, input().split())
l = [1] * (n + 1)
l[0] = 0 
h = list(map(int, input().strip().split())) 

for i in range(m):
  a, b = map(int, input().split())
  if h[a-1] < h[b-1]:
    l[a] = 0
  else :
    l[b] = 0
  

print(sum(l))