peterverebics/CodeNet_Python_118 huggingface dataset:
n,m=map(int,input().split(" "))
h=input().split(" ")
H=[]
hokan=[1 for i in range(n)]
for i in range(n):
  H.append(int(h[i]))
for i in range(m):
  a,b=map(int,input().split(" "))
  if H[a-1]>=H[b-1]:
    hokan[b-1]=0
  elif H[a-1]<H[b-1]:
    hokan[a-1]=0
    
print(sum(hokan))
import collections
n,m = list(map(int,input().split()))
tower_high = list(map(int,input().split()))
good_tower = [1]*n

def check_tower(a,b):
    if tower_high[a]<tower_high[b]:
        good_tower[a]=0
    else:
        good_tower[b]=0

for i in range(m):
    a,b=list(map(int,input().split()))
    check_tower(a-1,b-1)
print(good_tower.count(1))
n,m = map(int, input().split())
h=list(map(int, input().split()))
good=[True]*n
for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] >= h[b-1]:
    good[b-1]=False
  else:
    good[a-1]=False
ans=0
for i in good:
  if i:
    ans+=1
print(ans)
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:
        ans += 1

print(ans)
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
  else:
    P[B-1]=0
print(sum(P))
n,m=map(int,input().split())
ans=[]
ans=list(map(int,input().split()))
count=0
#di=defaultdict(list)
ma=[]
for i in range(m):
    a,b=map(int,input().split())
    if ans[a-1]>=ans[b-1] and ans[a-1] not in ma:
        count+=1
        ma.append(ans[a-1])
    if ans[b-1]>=ans[a-1] and ans[b-1] not in ma:
        count+=1
        ma.append(ans[b-1])
print(count)
n,m=map(int,input().split())
A=list(map(int,input().split()))

H=[True]*n
s=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    if A[a-1]>=A[b-1]:
        H[b-1]=False
    elif A[a-1]<=A[b-1]:
        H[a-1]=False

cnt=0
for i in range(n):
    if H[i]:
        cnt+=1
print(cnt)
count, way = list(map(int, input().split()))
height = list(map(int, input().split()))
isGood = [True] * count

for i in range(way):
    obs_a, obs_b = list(map(lambda x: int(x) - 1, input().split()))
    if(height[obs_a] > height[obs_b]):
        isGood[obs_b] = False
    else:
        isGood[obs_a] = False


print(len([ i for i in isGood if i ]))
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
route_list = [list(map(int, input().split())) for m in range(M)]
frag_N = [True for i in range(N)]

for A, B in route_list:
    if H_list[A-1] < H_list[B-1]:
        frag_N[A-1] = False
        frag_N[B-1] = True
    elif H_list[A-1] > H_list[B-1]:
        frag_N[A-1] = True
        frag_N[B-1] = False
    else:
        frag_N[A-1] = False
        frag_N[B-1] = False

print(frag_N.count(True))
n, m = map(int, input().split()) 
h = list(map(int, input().split()))
l = [0]*n
for i in range(m):
    A, B= map(int, input().split())
    if h[A-1] < h[B-1]:
      l[A-1] +=1
    elif h[B-1] < h[A-1]:
      l[B-1] +=1
print(n-l.count(0))
n,m=map(int,input().split())
h_list=list(map(int,input().split()))
col_list=[[0]*n for _ in range(n)]
count=0
for _ in range(m):
  a,b=map(int,input().split())
  col_list[a-1][b-1]+=1

for i in range(n):
  for j in range(n):
    if col_list[i][j]>=1 and h_list[i]<=h_list[j]:
      count+=1
      break
print(n-count)
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
ab = [[] for _ in range(n+1)]
check = [False for _ in range(n+1)]
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:  
      check[j] = True
      
print(check.count(True))
N,M = map(int,input().split())
H = list(map(int, input().split()))
AB = [sorted(list(map(int,input().split())))for i in range(M)]
AB.sort()
good = [True]*N
for i in range(N):
    if not good[i]:
        continue
    for a,b in AB:
        if a == i:
            if H[i] > H[b-1]:
                good[b-1] = False
            else:
                good[i] = False
                break
print(good.count(True))
import numpy as np

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

high = np.array([1]*n)
cnt = np.array([0]*n)

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1] < h[b-1]:
        high[a-1] *= 0
        
    
    elif h[a-1] > h[b-1]:
        high[b-1] *= 0

ans = np.count_nonzero(high==1)

print(ans)
n,m = list(map(int, input().split()))
i = list(map(int, input().split()))
k=i
ans=0
for j in range(m):
    a,b = list(map(int, input().split()))
    if i[a-1]==i[b-1]:
        k[a-1]=0
        k[b-1]=0
    else:
        if i[b-1]>i[a-1]:
            k[a-1]=0
        else:
            k[b-1]=0
            
for w in range(n):
    if k[w]!=0:
        ans+=1
print(ans)
print(k)
N, M = [int(i) for i in input().split()]
H = [None] + [int(i) for i in input().split()]
P = [False] + [True] * N
for i in range(M):
    A, B = [int(i) for i in input().split()]
    if H[A] > H[B]:
        P[B] = False
    if H[B] > H[A]:
        P[A] = False
    if H[B] == H[A]:
        P[A] == False
        P[B] == False
ans = 0
for i in P:
    if i:
        ans += 1
print(ans)
n,m=map(int,input().split())
h=list(map(int,input().split()))

ans=list(range(n))

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

print(sum([j>0 for j in ans]))
import numpy as np
N, M = map(int, input().split())
AB = []
H = input().split()
Hall = [1] * N

for i in range(M):
    a, b = map(int, input().split())
    AB.append([a, b])
    AH = H[a - 1]
    BH = H[b - 1]
    if AH >= BH:
        Hall[AB[i][1] - 1] = 0
    elif BH >= AH:
        Hall[AB[i][0] - 1] = 0


print(Hall.count(1))
#c 
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())
a=[0]*N
for x in range(M):
    if H[A[x]-1]>H[B[x]-1]:
        a[A[x]-1]=1
        a[B[x]-1]=0
    else:
        a[A[x]-1]=0
        a[B[x]-1]=1
sum=0
for y in a:
    sum+=y
print(sum)
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(a[i], b[i]))
    
print(len(good))
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]-1]>H[i[1]-1]:
        B[i[1]-1]=1
    elif H[i[0]-1]<H[i[1]-1]:
        B[i[0]-1]=1
print(B.count(0))
n, m = map(int, input().split())
h = [0] + list(map(int, input().split()))
ab = [[] for _ in range(n+1)]
check = [False for _ in range(n+1)]
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]:
      check[j] = True
      
print(check.count(True))
N, M = list(map(int, input().split()))
Hs = list(map(int, input().split()))
flg_list = [0] * N
for j in range(M):
    ai, bi = list(map(int, input().split()))
    ai -= 1
    bi -= 1
    if Hs[ai] > Hs[bi]:
        flg_list[ai] += 1
    else:
        flg_list[bi] += 1

print(flg_list.count(0))
N, M = (int(i) for i in input().split())
H = list(map(int,input().split()))
ans = [1]*N
for m in range(M):
    a, b = (int(i) for i in input().split())
    if H[a-1] < H[b-1]:
        ans[a-1] = 0
    else:
        ans[b-1] = 0
print(ans.count(1))
N,M = map(int,input().split())  #N個の展望台,M本の道

H_list = [int(x) for x in input().split()]

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

for i in range(M):
    B = [int(x) for x in input().split()]
    #print(B)
    
    if H_list[B[0]-1] < H_list[B[1]-1]:
        answer_list[B[0]-1] += 1
    else:
        answer_list[B[1]-1] += 1
cnt = 0
for j in range(N):
    if answer_list[j] == 0 :
        cnt += 1
    
print(cnt)
n, m = map(int, input().split())
h = list(map(int, input().split()))
count = 0

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

l=[]
for a in [int(i) for i in input().split()]:
  l.append(a)

ans_list=[1]*n  
  
for _ in range(m):
  a,b=(map(int,input().split()))
  if l[a-1]<l[b-1]:
    ans_list[a-1]=0
  else:
    ans_list[b-1]=0
  
#print(ans_list)
print(sum(ans_list))
N, M = map(int, input().split())
Hlist = list(map(int, input().split()))
ABList = []

ansdic = {}

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

for ab in ABList:
    if Hlist[ab[0]] < Hlist[ab[1]]:
        ansdic[Hlist[ab[1]]] = True
    else:
        ansdic[Hlist[ab[0]]] = True

print(len(ansdic))
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(m)]
s = [0 for i in range(n)]
for i in range(m):
    if h[a[i][0]-1] <= h[a[i][1]-1]:
        s[a[i][0]-1] += 1
    if h[a[i][0]-1] >= h[a[i][1]-1]:
        s[a[i][1]-1] += 1
ans = str(s)
print(ans.count('0'))
line = input().split(" ")
num = int(line[0])
road = int(line[1])
high = input().split(" ")
lowgroup = []
for i in range(road):
    a = input().split(" ")
    if int(high[int(a[0]) -1]) < int(high[int(a[1]) - 1]):
        lowgroup.append(a[0])
    else:
        lowgroup.append(a[1])
print(num - len(set(lowgroup)))
import sys
N,M=map(int,input().split())
H=list(map(int,input().split()))

#print(N,M,H)

bad=set()
for ln in sys.stdin:
    A,B=map(int,ln.split())
    x,y=H[A-1],H[B-1]
    if x>y:
        bad.add(y)
    elif x<y:
        bad.add(x)
    else:
        bad.add(x)
        bad.add(y)

print(N-len(bad))
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())
    A[i] -= 1
    B[i] -= 1
lis = []
for i in range(M):
    lis.append(max(H[A[i]],H[B[i]]))
print(len(set(lis)))
N,M = map(int,input().split())
H = list(map(int,input().split()))
good = []
for i in range(M):
    A,B = map(int,input().split())
    if H[A-1] > H[B-1]:
        good.append(H[A-1])
        if H[B-1] in good:
            good.remove(H[B-1])
    elif H[A-1] < H[B-1]:
        good.append(H[B-1])
        if H[A-1] in good:
            good.remove(H[A-1])
print(len(set(good)))
n, m = map(int, input().split())
h = list(map(int, input().split()))
p = [False] + [True]*n
A = []
B = []
for i in range(m):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)

for i in range(m):
    if h[A[i] - 1] > h[B[i] - 1]:
        p[B[i]] = False
    if h[A[i] - 1] < h[B[i] - 1]:
        p[A[i]] = False
    else:
        p[A[i]] = False
        p[B[i]] = False

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

print(len(ans))
N, M = map(int, input().split())
H = [int(x) for x in input().split()]

a = [0]*len(H)

for i in range(M):
    A = [int(x) for x in input().split()]
    if H[A[0]-1] > H[A[1]-1]:
        a[A[1]-1] += -1
    else:
        a[A[0]-1] += -1

print(a.count(0))
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
N,M=MI()
H=[0]+LI()
L=[[] for i in range(N+1)]
ans=0
for _ in range(M):
  a,b=MI()
  L[a].append(b)
  L[b].append(a)
for i in range(1,N+1):
  for j in L[i]:
    #print(i,H[i],j,H[j])
    if H[i]<=H[j]:
      break
  ans+=1
ans//=2
print(ans)
n, m = list(map(int, input().split()))
H = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

ans = [1] * (n)
route = [1] * (n)
for i in range(len(ab)):
    a, b = ab[i]
    if H[a-1] <= H[b-1]:
      ans[a-1] = 0

    elif H[b-1] <= H[a-1]:
      ans[b-1] = 0
    
print(sum(ans))
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
    elif H[A-1] < H[B-1]:
        ans[A-1] = 0
    else:
        H[A-1] = 0
        H[B-1] = 0

print(sum(ans))
import numpy as np

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

high = np.array([0]*n)
cnt = np.array([0]*n)

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1] > h[b-1]:
        high[a-1] -= 1
        
    
    elif h[a-1] < h[b-1]:
        high[b-1] -= 1
    cnt[a-1] += 1
    cnt[b-1] += 1

ans = np.count_nonzero(high==0) +np.count_nonzero(cnt==0)

print(ans)
n,m = map(int,input().split())
h = list(map(int,input().split()))
tenbo = [list(map(int,input().split())) for _ in range(m)]
#print(tenbo)
tree = [[0]for _ in range(n)]
for i in range(m):

	x = tenbo[i]
	x1 = x[0]
	x2 = x[1]
	#print(x1)
	y1 = h[x1-1]
	y2 = h[x2-1]
	a = [y1,y2]
	#print(x[1])
	tree[x[0]-1].extend(a)
	tree[x[1]-1].extend(a)
c = 0
for i in range(n):
	if max(tree[i]) <=h[i]:
		if len(tree[i]) != 1:
		#print(max(tree[i]))
			c += 1
print(c)
N,M = map(int,input().split())
H = []
H = list(map(int,input().split()))
route = []
h_max = 0
count = 0
h_max_list = []
for i in range(M):
    route.append(list(map(int,input().split())))

for i in range(1,N+1):
    for j in range(M):
        if i in route[j]:
            h_max = max(H[route[j][0]-1],H[route[j][1]-1])
            if H.index(h_max)+1 == i:
                h_max_list.append(H.index(h_max)+1)

print(len(set(h_max_list)))
n, m = map(int, input().split())
h = list(map(int, input().split()))
M = []

p = [1] * n
for i in range(m):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    if h[a] > h[b]:
        p[b] = 0
    elif h[a] < h[b]:
        p[a] = 0
    else:
        if p[a] == 0: p[b] = 0
        if p[b] == 0: p[a] = 0


# print(p)
# print(M)
print(p.count(1))
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())
    # h[a-1], h[b-1] min
    mm = h.index(min(h[a-1], h[b-1]))
    if h[a-1] == h[b-1]:
        ans[a-1], ans[b-1] = 0, 0
    ans[mm] = 0

print(sum(ans))
N, M = map(int,input().split())
H = list(map(int,input().split()))
A = []
B = []
flag = [0] * N

for __ in range(M):
    _A, _B = map(int,input().split())
    A.append(_A)
    B.append(_B)
    

for i in range(M):
    if H[A[i] - 1] > H[B[i] - 1]:
        flag[A[i] - 1] = 1
    else:
        flag[B[i] - 1] = 1        
print(sum(flag))
n,m=map(int, input().split())
h = list(map(int, input().split()))
ab = [list(sorted(map(int, input().split()))) for i in range(m)]
ab = list(map(list, set(map(tuple, ab))))
includeList = []
for i in range(len(ab)):
    if includeList.count(ab[i][0]) > 0 or includeList.count(ab[i][1] > 0):
        continue
    elif h[ab[i][0]-1] < h[ab[i][1]-1]:
        n -= 1
        includeList.append(ab[i][0])
    elif h[ab[i][0]-1] > h[ab[i][1]-1]:
        n -= 1
        includeList.append(ab[i][1])
print(n)
import collections
n,m = (int(i) for i in input().split())
h = [int(i) for i in input().split()]
ab =[[0]]*n
print(ab)
for _ in range(m):
	a,b = (int(i) for i in input().split())
	if h[a-1]-h[b-1]>0:
		ab[b-1]=["a"]

	elif h[a-1]-h[b-1]<0:
		ab[a-1]=["a"]

	else:
		ab[a-1]=["a"]
		ab[b-1]=["a"]


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

A_B = [""] * M

for c in range(M):
    A_B[c] = list(map(int, input().split()))

hd = {}

for co in range(N):
    hd[co + 1] = H[co]

print(hd)
print("a")
n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[y-1] = 1
if height[x-1] <= height[y-1]:
    lst[x-1] = 1
print(lst.count(0))
n, m = map(int, input().split())

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

flags = [True] * n

for _ in range(m):
    a, b = map(int, input().split())
    if h[a-1] > h[b-1]:
        flags[b-1] = False
    if h[b-1] > h[a-1]:
        flags[a-1] = False
    else:
        flags[a-1] = False
        flags[b-1] = False

print(flags.count(True))
n,m=map(int,input().split())
h=list(map(int,input().split()))
i=h.index(max(h))+1
num=0
for _ in range(m):
    if i in list(map(int, input().split())):
        num += 1
print(num+1)
N,M = (int(x) for x in input().split())
list = [int(x) for x in input().split()]
tenbou = [input().split() for l in range(M)]
jj = [1] * N

#print(list)
#print(tenbou)

for i in range(M-1):
    x = int(tenbou[i][0]) - 1
    y = int(tenbou[i][1]) - 1
    if list[x] >= list[y]:
        jj[y] = 0
    elif list[y] > list[x]:
        jj[x] = 0


#print(jj)       
#print(jj)
print(jj.count(1))
N, M = map(int,input().split())
H = list(map(int,input().split()))
A = []
B = []
flag = [0] * N

for __ in range(M):
    _A, _B = map(int,input().split())
    A.append(_A)
    B.append(_B)

    if H[_A - 1] > H[_B - 1]:
        flag[_A - 1] = 1
    elif H[_A - 1] < H[_B - 1]:
        flag[_B - 1] = 1
        
print(sum(flag) + len(set(range(1, N + 1)) - (set(A) | set(B))))
import numpy as np
n,m = [int(i) for i in input().split()]

h = [int(i) for i in input().split()]

l = [[int(i)-1 for i in input().split()] for _ in range(m)]

ans = np.array([1 for _ in range(n)])

for x,y in l:
    if h[x]>=h[y]:
        ans[y] = 0
    else:
        ans[x] = 0
        
print(np.count_nonzero(ans))
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
    db = [x for x in c[i] if c[i].count(x) > 1]
    for j in c[i]:
        mh = h[j] if mh < h[j] and not j in db else mh
    r += 1 if h[i] > mh or len([i]) == 0 else 0
print(r)
n,m=map(int,input().split())
l=list(map(int,input().split()))
d={}
for i in range(n):
  d[i+1]=l[i]
not_good=[]
for i in range(m):
  a,b=map(int,input().split())
  if d[a]>d[b]:
    if not b in not_good:
      not_good.append(b)
  if d[a]<d[b]:
    if not a in not_good:
      not_good.append(a)
  else:
    if not a in not_good:
      not_good.append(a)
    if not b in not_good:
      not_good.append(b)

print(n-len(not_good))
N,M = map(int, input().split())
H = list(map(int, input().split()))
A = [ list(map(int,input().split(" "))) for i in range(M)]
C = []
for i in range(N):
	C.append(True)
for i in range(M):
	x = A[i][0]
	y = A[i][1]
	if H[x-1] > H[y-1]:
		C[x-1] = True
		C[y-1] = False
	elif H[x-1] < H[y-1]:
		C[x-1] = False
		C[y-1] = True
print(sum(C))
import collections
n,m=map(int,input().split())
H=list(map(int,input().split()))
blacklist=[]
Li=[]
for i in range(m):
    a,b=map(int,input().split())
    if [a,b] not in Li:
        Li.append([a,b])
        Ha,Hb=H[a-1],H[b-1]
        if Ha<Hb:
            blacklist.append(a)
        elif Ha>Hb:
            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=list(map(int,input().split()))
h_list=list(map(int,input().split()))
h2_list=[True]*N

for _ in range(M):
    A,B=list(map(int,input().split()))
    if h_list[A-1] < h_list[B-1]:
        h2_list[A-1] = False
    elif h_list[A-1] > h_list[B-1]:
        h2_list[B-1] = False
    else:
        h2_list[A-1] = False
        h2_list[B-1] = False


ans = 0
for h2 in h2_list:
    if not h2:
        ans+=1
print(ans)
N,M = map(int,input().split())
H = []
H = list(map(int,input().split()))
route = []
h_max = []
for i in range(M):
    route.append(list(map(int,input().split())))
for i in range(M):
    if H[route[i][0]-1] > H[route[i][1]-1]:
        h_max.append(route[i][0])
    elif H[route[i][0]-1] < H[route[i][1]-1]:
        h_max.append(route[i][1])
    else:
        h_max.append(route[i][0])
 
print(len(set(h_max)))
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[[]]*(n)
for i in range(m):
	a,b=map(int,input().split())
	L[a-1] = L[a-1]+[H[b-1]]
	L[b-1] = L[b-1]+[H[a-1]]
	
#print(L)

count=0
for i in range(n):
	if L[i]!=[]:
		if H[i-1]>max(L[i]):
			count+=1
	else:
		count+=1
		
print(count)
#!/usr/bin/env python3
n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = []
for _ in range(m):
    a, b = map(int, input().split())
    if h[a-1] > h[b-1]:
        ans.append(b-1)
    elif h[a-1] < h[b-1]:
        ans.append(a - 1)
    else:
        ans.append(a - 1)
        ans.append(b - 1)
print(len(set(ans)))
N,M = map(int,input().split())
H = list(map(int,input().split()))

tmp = [1] * N
max = 0

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

print(tmp)    
#tmp[H.index(max(H))] = 1
print(sum(tmp))
n,m=map(int,input().split())
height = list(map(int,input().split()))
lst = [0] * n
for j in range(m):
  a,b=map(int,input().split())
  if height[a-1]<height[b-1]:
    lst[a-1]=-1
    lst[b-1]+=1
  elif height[a-1]>height[b-1]:
    lst[a-1]+=1
    lst[b-1]=-1
  elif height[a-1]==height[b-1]:
    lst[a-1] = -1
    lst[b-1] = -1
cnt = 0
print(lst)
for k in range(n):
  if lst[k]>=0:
    cnt+=1
print(cnt)
N,M = map(int,input().split())
height_list = list(map(int,input().split()))
road_list = []

for i in range(M):
    road_list.append(list(map(int,input().split())))
    
print(height_list)
print(road_list)
print(road_list[0])
N, M = map(int, input().split())

# N本分入る．
H = input().split()

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

print(len(list(set(arr))))
n,m = map(int, input().split())
h=list(map(int,input().split()))
li=[0]*n

for i in range(m):
        a,b=map(int, input().split())
        if h[a-1]>=h[b-1]:
                li[b-1]+=1
        elif h[b-1]>=h[a-1]:
                li[a-1]+=1

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

print(cnt)
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [1 for _ in range(n)]

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

cnt = 0
for i in l:
  if i == 1:
    cnt += 1

print(cnt)
N, M = (int(x) for x in input().split())
H = list(map(int, input().split()))

GT = [1 for i in range(N)]

for i in range(M):
    A, B = (int(x) for x in input().split())
    if H[A-1] != H[B-1]:
        L = min(H[A-1], H[B-1])
        GT[H.index(L)] = 0
    else:
        GT[A-1] = 0
        GT[B-1] = 0
    
print(GT)
n,m=map(int,input().split())
h=list(map(int,input().split()))
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]=='x' or h[b-1]=='x':
    None
  elif h[a-1]>h[b-1]:
    h[b-1]='x'
  elif h[a-1]<h[b-1]:
    h[a-1]='x'
  else:
    h[a-1]='x'
    h[b-1]='x'
print(n-h.count('x'))
n,m = map(int,input().split())
h_list = input().split(" ")
result = [0 for i in range(n)]
for i in range(m):
    temp1, temp2 = map(int, input().split())
    if h_list[temp1-1] <= h_list[temp2-1]:
        result[temp1-1] = -1
    if h_list[temp1-1] >= h_list[temp2-1]:
        result[temp2-1] = -1
print(result.count(0))
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

def main():
  N, M = map(int, input().split())

  height = [i for i in list(map(int, input().split()))]

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

  for i in range(M):
    a, b = map(int, input().split())
    if height[a-1] < height[b-1]:
      results[a-1] = 1
    else:
      results[b-1] = 1
  print(results.count(0))

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())
g = [0] * n
for i in range(m):
    if h[a[i]-1] < h[b[i]-1]:
        g[a[i]-1] = 1
    if h[a[i] - 1] > h[b[i] - 1]:
        g[b[i]-1] = 1
c = 0
for i in range(n):
    if g[i] == 0:
        c += 1

print(c)