AtCoder Beginner Contest 166 - Peaks

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.

Source: atcoder | Difficulty: EASY


Solutions:
(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 H[a] <= H[b]:
		l[a] = 0
print(sum(l))


(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)


(N, M) = list(map(int, input().split()))
H = list(map(int, input().split()))
t = [0] * N
for i in range(M):
	(A, B) = list(map(int, input().split()))
	t[A - 1] = max(t[A - 1], H[B - 1])
	t[B - 1] = max(t[B - 1], H[A - 1])
ans = 0
for i in range(N):
	if t[i] < H[i]:
		ans += 1
print(ans)


f = lambda : map(int, input().split())
(N, M) = f()
(*H,) = f()
g = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = f()
	g[a - 1].append(b - 1)
	g[b - 1].append(a - 1)
print(sum((all((H[j] < H[i] for j in g[i])) for i in range(N))))


(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[b - 1] = 0
	else:
		l[a - 1] = 0
print(sum(l))


(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(c)


(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[B - 1] += 1
	if H[B - 1] >= H[A - 1]:
		c[A - 1] += 1
print(c.count(0))


(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())
	if h[a - 1] <= h[b - 1]:
		g[a - 1] = 0
	if h[a - 1] >= h[b - 1]:
		g[b - 1] = 0
print(g.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())
	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()))
l = [1] * n
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	if h[a] <= h[b]:
		l[a] = 0
	if h[b] <= h[a]:
		l[b] = 0
ans = sum(l)
print(ans)


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


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


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
bad = {}
for i in range(M):
	(A, B) = map(int, input().split())
	if H[A - 1] <= H[B - 1]:
		bad[A] = 1
	if H[A - 1] >= H[B - 1]:
		bad[B] = 1
print(N - len(bad))


(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()))
ans = [1] * n
for i in range(m):
	(ai, bi) = map(int, input().split())
	if h[ai - 1] >= h[bi - 1]:
		ans[bi - 1] = 0
	if h[ai - 1] <= h[bi - 1]:
		ans[ai - 1] = 0
print(sum(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(ans)


(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()))
Towers = [True] * n
for i in range(m):
	(a, b) = map(int, input().split())
	if H[a - 1] <= H[b - 1]:
		Towers[a - 1] = False
	if H[b - 1] <= H[a - 1]:
		Towers[b - 1] = False
print(sum(Towers))


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


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


(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()))
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) = map(int, input().split())
H = [0] + list(map(int, input().split()))
s = set()
for _ in range(M):
	(A, B) = map(int, input().split())
	if H[A] >= H[B]:
		s.add(B)
	if H[A] <= H[B]:
		s.add(A)
print(N - len(s))


(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) = 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())
h = list(map(int, input().split()))
h.insert(0, 0)
s = set()
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a] <= h[b]:
		s.add(a)
	if h[a] >= h[b]:
		s.add(b)
print(n - len(s))


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) = 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) = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
f = [1] * N
for _ in range(M):
	(A, B) = [int(x) for x in input().split()]
	i = H[A - 1]
	j = H[B - 1]
	if i <= j:
		f[A - 1] = 0
	if i >= j:
		f[B - 1] = 0
print(sum(f))


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()


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
s = set()
for i in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	if H[a] > H[b]:
		s.add(b)
	elif H[a] < H[b]:
		s.add(a)
	else:
		s.add(a)
		s.add(b)
print(N - len(s))


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


(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) = map(int, input().split())
H = list(map(int, input().split()))
flg = [1] * N
for m in range(M):
	(a, b) = map(int, input().split())
	if H[a - 1] < H[b - 1]:
		flg[a - 1] = 0
	elif H[a - 1] > H[b - 1]:
		flg[b - 1] = 0
	else:
		flg[a - 1] = flg[b - 1] = 0
print(flg.count(1))


(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()))
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()))
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))


I = lambda : map(int, input().split())
(N, M) = I()
H = [0] + list(I())
O = [0] + [1] * N
for _ in range(M):
	(A, B) = I()
	if H[A] <= H[B]:
		O[A] = 0
	if H[A] >= H[B]:
		O[B] = 0
print(O.count(1))


(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 = 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) = map(int, input().split())
hl = list(map(int, input().split()))
ans = {}
for i in range(M):
	(a, b) = map(int, input().split())
	if hl[a - 1] <= hl[b - 1]:
		ans[a] = False
	if hl[a - 1] >= hl[b - 1]:
		ans[b] = False
print(N - len(ans))


(n, m) = map(int, input().split())
h = [None] + [int(x) for x in input().split()]
res = [0] + [1] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	if h[a] >= h[b]:
		res[b] = 0
	if h[a] <= h[b]:
		res[a] = 0
print(sum(res))


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


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


R = lambda : map(int, input().split())
(n, m) = R()
h = [None, *R()]
g = [0] + [1] * n
for _ in range(m):
	(a, b) = R()
	if h[a] <= h[b]:
		g[a] = 0
	if h[b] <= h[a]:
		g[b] = 0
print(sum(g))


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
good = [True] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	if h[a] <= h[b]:
		good[a] = False
	if h[b] <= h[a]:
		good[b] = False
print(sum(good))


(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)))


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


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


(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, h, *t) = [[*map(int, t.split())] for t in open(0)]
p = [1] * n[0]
for (a, b) in t:
	(x, y) = (h[a - 1], h[b - 1])
	p[-a] &= x > y
	p[-b] &= y > x
print(sum(p))


(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(sum(out))


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


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


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
s = []
for _ in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	if h[a] <= h[b]:
		s.append(a)
	if h[a] >= h[b]:
		s.append(b)
print(n - len(set(s)))


ri = lambda : map(int, input().split())
(N, M) = ri()
H = list(ri())
T = [0] * N
for _ in range(M):
	(a, b) = ri()
	T[a - 1] = max(T[a - 1], H[b - 1])
	T[b - 1] = max(T[b - 1], H[a - 1])
print(sum((1 for (i, h) in enumerate(T) if h == 0 or h < H[i])))


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
top = [True] * N
for i in range(M):
	(A, B) = map(int, input().split())
	if H[A - 1] <= H[B - 1]:
		top[A - 1] = False
	if H[A - 1] >= H[B - 1]:
		top[B - 1] = False
print(sum(top))


(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) = 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)


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())
x = list(map(int, input().split()))
y = []
for i in range(m):
	(s, t) = map(int, input().split())
	if x[s - 1] < x[t - 1]:
		y.append(s)
	elif x[s - 1] > x[t - 1]:
		y.append(t)
	else:
		y.append(s)
		y.append(t)
z = set(y)
print(n - len(z))


(n, *t) = map(int, open(0).read().split())
r = [0] + [1] * n
for (a, b) in zip(t[n + 1::2], t[n + 2::2]):
	r[a] &= t[a] > t[b]
	r[b] &= t[b] > t[a]
print(sum(r))


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


(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()))
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())
H = list(map(int, input().split()))
is_best = [True] * n
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	is_best[a] &= H[a] > H[b]
	is_best[b] &= H[a] < H[b]
print(is_best.count(True))


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
good = [True] * N
for _ in range(M):
	(A, B) = map(int, input().split())
	A -= 1
	B -= 1
	if H[A] >= H[B]:
		good[B] = False
	if H[A] <= H[B]:
		good[A] = False
print(sum(good))


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


(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) = 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())
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)


import sys
input = sys.stdin.readline
f = lambda : map(int, input().split())
(n, m) = f()
l = list(f())
t = [1] * n
g = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = f()
	if l[a - 1] <= l[b - 1]:
		t[a - 1] = 0
	if l[b - 1] <= l[a - 1]:
		t[b - 1] = 0
print(sum(t))


(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 = [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)


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
h = [1 for _ in range(N)]
for i in range(M):
	A = list(map(int, input().split()))
	Ah = H[A[0] - 1]
	Bh = H[A[1] - 1]
	if Ah >= Bh:
		h[A[1] - 1] = 0
	if Ah <= Bh:
		h[A[0] - 1] = 0
print(sum(h))


(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 = list(map(int, input().split()))
top = []
for i in range(n):
	top.append(1)
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a - 1] <= h[b - 1]:
		top[a - 1] = 0
	if h[b - 1] <= h[a - 1]:
		top[b - 1] = 0
print(sum(top))


(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))


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())
H = list(map(int, input().split()))
H2 = [True] * N
for i in range(M):
	(A, B) = map(int, input().split())
	if H[A - 1] <= H[B - 1]:
		H2[A - 1] = False
	if H[B - 1] <= H[A - 1]:
		H2[B - 1] = False
print(H2.count(True))


(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))


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
OK = [True] * N
for m in range(M):
	(a, b) = map(int, input().split())
	if H[a - 1] <= H[b - 1]:
		OK[a - 1] = False
	if H[b - 1] <= H[a - 1]:
		OK[b - 1] = False
print(OK.count(True))


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


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


(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)


(N, M) = map(int, input().split())
Hs = list(map(int, input().split()))
bad = set()
for _ in range(M):
	(a, b) = map(int, input().split())
	if Hs[a - 1] <= Hs[b - 1]:
		bad.add(a)
	if Hs[b - 1] <= Hs[a - 1]:
		bad.add(b)
print(N - len(bad))


(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))


def __starting_point():
	(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()


f = lambda : map(int, input().split())
(n, m) = f()
l = list(f())
t = [1] * n
for _ in range(m):
	(a, b) = f()
	if l[a - 1] <= l[b - 1]:
		t[a - 1] = 0
	if l[b - 1] <= l[a - 1]:
		t[b - 1] = 0
print(sum(t))


(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())
	(a, b) = (A - 1, B - 1)
	if H[a] >= H[b]:
		L[b] = 0
	if H[b] >= H[a]:
		L[a] = 0
print(sum(L))


(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])
ans = 0
for i in range(N):
	Heighest = 0
	for j in range(len(Lists[i])):
		Heighest = max(Heighest, H[Lists[i][j]])
	if Heighest < H[i]:
		ans += 1
print(ans)


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


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
H.insert(0, 0)
s = set()
for i in range(M):
	(a, b) = map(int, input().split())
	if H[a] <= H[b]:
		s.add(a)
	if H[a] >= H[b]:
		s.add(b)
print(N - len(s))


(N, M) = map(int, input().split())
h = list(map(int, input().split()))
t = [0] * N
for i in range(M):
	(A, B) = map(int, input().split())
	t[A - 1] = max(t[A - 1], h[B - 1])
	t[B - 1] = max(t[B - 1], h[A - 1])
ct = 0
for j in range(N):
	if h[j] > t[j]:
		ct += 1
print(ct)


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


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


(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) = map(int, input().split())
H = list(map(int, input().split()))
H.insert(0, 0)
S = set()
for m in range(M):
	(A, B) = map(int, input().split())
	if H[A] <= H[B]:
		S.add(A)
	if H[A] >= H[B]:
		S.add(B)
print(N - len(S))


(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) = map(int, input().split())
H = list(map(int, input().split()))
sm = []
for i in range(M):
	(A, B) = map(int, input().split())
	if H[A - 1] <= H[B - 1]:
		sm.append(A)
	if H[B - 1] <= H[A - 1]:
		sm.append(B)
print(N - len(set(sm)))


(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) = 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)


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


I = lambda : map(int, input().split())
(N, M) = I()
(*H,) = I()
m = [0] * N
for _ in [0] * M:
	(A, B) = I()
	m[A - 1] = max(m[A - 1], H[B - 1])
	m[B - 1] = max(m[B - 1], H[A - 1])
print(sum((1 for i in range(N) if H[i] > m[i])))


(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)


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
A = [0] * N
for i in range(M):
	(a, b) = map(int, input().split())
	A[a - 1] = max(A[a - 1], H[b - 1])
	A[b - 1] = max(A[b - 1], H[a - 1])
res = sum([H[i] > A[i] for i in range(N)])
print(res)


(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) = map(int, input().split())
Hs = list(map(int, input().split()))
ans = [1 for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	if Hs[a - 1] <= Hs[b - 1]:
		ans[a - 1] = 0
	if Hs[b - 1] <= Hs[a - 1]:
		ans[b - 1] = 0
print(sum(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())
	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(sum(anslist))


(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, *HAB) = map(int, open(0).read().split())
(H, AB) = ([0] + HAB[:N], HAB[N:])
good = [False] + [True] * N
for (a, b) in zip(*[iter(AB)] * 2):
	if H[a] >= H[b]:
		good[b] = False
	if H[b] >= H[a]:
		good[a] = False
print(sum(good))


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) = map(int, input().split())
H = list(map(int, input().split()))
memo = [1] * N
for i in range(M):
	(Ai, Bi) = map(int, input().split())
	if H[Ai - 1] <= H[Bi - 1]:
		memo[Ai - 1] = 0
	if H[Bi - 1] <= H[Ai - 1]:
		memo[Bi - 1] = 0
print(sum(memo))


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


(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))


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
good = set(range(n))
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a - 1] <= h[b - 1]:
		good.discard(a - 1)
	if h[b - 1] <= h[a - 1]:
		good.discard(b - 1)
print(len(good))


(N, M, *I) = map(int, open(0).read().split())
(H, AB) = ([0] + I[:N], I[N:])
memo = [0] * (N + 1)
for (a, b) in zip(*[iter(AB)] * 2):
	memo[a] = max(memo[a], H[b])
	memo[b] = max(memo[b], H[a])
print(sum((h > ma for (h, ma) in zip(H[1:], memo[1:]))))


L = lambda : list(map(int, input().split()))
(n, m) = L()
h = L()
(e, c) = ([[] for _ in range(n)], 0)
for i in range(m):
	(a, b) = L()
	e[a - 1] += (b - 1,)
	e[b - 1] += (a - 1,)
for i in range(n):
	if all((h[i] > h[v] for v in e[i])):
		c += 1
print(c)


(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) = map(int, input().split())
h = list(map(int, input().split()))
flag = [True for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a - 1] >= h[b - 1]:
		flag[b - 1] = False
	if h[b - 1] >= h[a - 1]:
		flag[a - 1] = False
print(flag.count(True))


((n, m), h, *r) = [[*map(int, i.split())] for i in open(0)]
g = [] + h
for i in r:
	g[i[0] - 1] *= h[i[0] - 1] > h[i[1] - 1]
	g[i[1] - 1] *= h[i[1] - 1] > h[i[0] - 1]
print(len([i for i in g if i != 0]))


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()))
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)
count = 0
for a in range(N):
	for b in paths[a]:
		if H[b] >= H[a]:
			break
	else:
		count += 1
print(count)


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()))
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)


def __starting_point():
	(N, M) = list(map(int, input().split()))
	Hli = list(map(int, input().split()))
	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.count(0))
__starting_point()


def LI():
	return list(map(int, input().split()))
(n, m) = LI()
h = LI()
edge = [[] for i in range(n)]
for i in range(m):
	(a, b) = LI()
	edge[a - 1].append(b - 1)
	edge[b - 1].append(a - 1)
ans = 0
for i in range(n):
	if all([h[i] > h[j] for j in edge[i]]):
		ans += 1
print(ans)


(N, M) = map(int, input().split())
(*H,) = map(int, input().split())
good = [True] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	good[a] &= H[a] > H[b]
	good[b] &= H[b] > H[a]
print(sum(good))


(n, m) = map(int, input().split())
tenbo = [1 for i in range(n + 1)]
t = list(map(int, input().split()))
h = [0] + t
tenbo[0] = 0
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a] >= h[b]:
		tenbo[b] = 0
	if h[a] <= h[b]:
		tenbo[a] = 0
print(sum(tenbo))


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
l = []
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	if h[a] < h[b]:
		l.append(a)
	elif h[a] == h[b]:
		l += [a, b]
	else:
		l.append(b)
s = set(l)
print(n - len(s))


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


import sys
from collections import deque, Counter, defaultdict
import bisect
import heapq
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))


(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) = 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))


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)]
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) = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
li = [1] * n
for i in ab:
	if h[i[0] - 1] >= h[i[1] - 1]:
		li[i[1] - 1] -= 1
	if h[i[0] - 1] <= h[i[1] - 1]:
		li[i[0] - 1] -= 1
print(li.count(1))


(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) = 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()))
ans = [1] * N
for i in range(M):
	(A, B) = map(int, input().split())
	x = H[A - 1]
	y = H[B - 1]
	if x > y:
		ans[B - 1] = 0
	elif x == y:
		ans[B - 1] = 0
		ans[A - 1] = 0
	elif y > x:
		ans[A - 1] = 0
print(sum(ans))


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


(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())
is_good = [True] * N
H = list(map(int, input().split()))
for _ in range(M):
	(A, B) = map(lambda n: int(n) - 1, input().split())
	is_good[A] &= H[A] > H[B]
	is_good[B] &= H[A] < H[B]
print(sum(is_good))


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()))
p = [1] * n
max = 0
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 = [int(x) for x in input().split()]
d = [1] * N
for i in range(M):
	(A, B) = map(int, input().split())
	if H[A - 1] >= H[B - 1]:
		d[B - 1] = 0
	if H[A - 1] <= H[B - 1]:
		d[A - 1] = 0
print(sum(d))


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


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


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


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()


(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()))
X = [1] * N
for i in range(M):
	(x, y) = map(int, input().split())
	if H[x - 1] > H[y - 1]:
		X[y - 1] = 0
	elif H[x - 1] < H[y - 1]:
		X[x - 1] = 0
	else:
		X[x - 1] = 0
		X[y - 1] = 0
print(sum(X))


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
small = set()
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a - 1] >= h[b - 1]:
		small.add(b)
	if h[b - 1] >= h[a - 1]:
		small.add(a)
print(n - len(small))


(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
	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())
hi = [0] + list(map(int, input().split()))
judge = [0] + [1] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	if hi[a] >= hi[b]:
		judge[b] = 0
	if hi[a] <= hi[b]:
		judge[a] = 0
print(sum(judge))


(n, h, *t) = [[0] + [*map(int, t.split())] for t in open(0)]
p = [1] * n[1]
for (_, a, b) in t:
	p[-a] &= h[a] > h[b]
	p[-b] &= h[b] > h[a]
print(sum(p))


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


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
L = [1 for i in range(N)]
for i in range(M):
	(A, B) = map(int, input().split())
	HA = H[A - 1]
	HB = H[B - 1]
	if HA >= HB:
		L[B - 1] = 0
	if HB >= HA:
		L[A - 1] = 0
print(sum(L))


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


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


(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(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) = map(int, input().split())
h = list(map(int, input().split()))
cnt = n
ng = {}
for i in range(m):
	(a, b) = map(int, input().split())
	if h[a - 1] >= h[b - 1]:
		ng[b] = 1
	if h[a - 1] <= h[b - 1]:
		ng[a] = 1
print(n - len(ng))


(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)


(n, m) = map(int, input().split())
dame = set()
h = list(map(int, input().split()))
for x in range(m):
	(a, b) = map(int, input().split())
	ah = h[a - 1]
	bh = h[b - 1]
	if ah >= bh:
		dame.add(b)
	if bh >= ah:
		dame.add(a)
print(n - len(dame))


(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) = 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 = [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)


(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())
	Ah = H[A - 1]
	Bh = H[B - 1]
	if Ah >= Bh:
		P[B - 1] = 0
	if Bh >= Ah:
		P[A - 1] = 0
print(sum(P))


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


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)


(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) = 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) = map(int, input().split())
H = list(map(int, input().split()))
C = [1] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	if H[a] <= H[b]:
		C[a] = 0
	if H[b] <= H[a]:
		C[b] = 0
ans = sum(C)
print(ans)


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))
	M = int(next(tokens))
	H = [int(next(tokens)) for _ in range(N)]
	A = [int()] * M
	B = [int()] * M
	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())
H = list(map(int, input().split()))
G = {i + 1 for i in range(N)}
for _ in range(M):
	(a, b) = map(int, input().split())
	if H[a - 1] > H[b - 1]:
		G -= {b}
	elif H[b - 1] > H[a - 1]:
		G -= {a}
	else:
		G -= {a, b}
print(len(G))


(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)


(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)
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)


(n, m) = map(int, input().split())
H = list(map(int, input().split()))
A = []
for i in range(m):
	(a, b) = map(int, input().split())
	if H[a - 1] <= H[b - 1]:
		A.append(a)
	if H[a - 1] >= H[b - 1]:
		A.append(b)
A = set(A)
print(n - len(A))


(N, M) = map(int, input().split())
H = [int(h) for h in input().split()]
flag = [1 for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	if H[a - 1] <= H[b - 1]:
		flag[a - 1] = 0
	if H[a - 1] >= H[b - 1]:
		flag[b - 1] = 0
print(sum(flag))


from operator import itemgetter
(n, m) = map(int, input().split())
h = list(map(int, input().split()))
t = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	if h[a] <= h[b]:
		t[a] = 1
	if h[b] <= h[a]:
		t[b] = 1
print(n - sum(t))


(N, M) = map(int, input().split())
H = list(map(int, input().split()))
l = [1] * N
for i in range(M):
	(A, B) = map(lambda x: int(x) - 1, input().split())
	if H[A] >= H[B]:
		l[B] = 0
	if H[A] <= H[B]:
		l[A] = 0
print(sum(l))


(n, m) = map(int, input().split())
h = list(map(int, input().split()))
s = set()
for _ in range(m):
	(a, b) = map(int, input().split())
	a_h = h[a - 1]
	b_h = h[b - 1]
	if a_h >= b_h:
		s.add(b)
	if a_h <= b_h:
		s.add(a)
ans = n - len(s)
print(ans)


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)


import math
(N, M) = map(int, input().split())
H = list(map(int, input().split()))
G = [1] * N
j = 0
for i in range(M):
	(a, b) = map(int, input().split())
	if H[a - 1] > H[b - 1]:
		G[b - 1] = 0
	elif H[a - 1] < H[b - 1]:
		G[a - 1] = 0
	else:
		G[a - 1] = 0
		G[b - 1] = 0
print(G.count(1))


(n, m) = map(int, input().split())
h = [0] * n
r = [1] * n
h[:] = map(int, input().split())
for ii in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	if h[a] >= h[b]:
		r[b] = 0
	if h[b] >= h[a]:
		r[a] = 0
print(sum(r))


(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) = map(int, input().split())
H = list(map(int, input().split()))
D = [list(map(int, input().split())) for _ in range(M)]
G = [1] * N
for (a, b) in D:
	a -= 1
	b -= 1
	if H[a] > H[b]:
		G[b] = 0
	elif H[a] < H[b]:
		G[a] = 0
	else:
		G[a] = 0
		G[b] = 0
print(sum(G))


(_, 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()))
a = [True] * N
for i in range(M):
	(ai, bi) = map(int, input().split())
	if H[ai - 1] <= H[bi - 1]:
		a[ai - 1] = False
	if H[ai - 1] >= H[bi - 1]:
		a[bi - 1] = False
print(sum(a))


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))


(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)