#int(input()) #map(int, input().split()) #list(map(int, input().split())) N, M, S, T = map(int, input().split()) p = list(map(int, input().split())) to = [[] for i in range(N)] for i in range(M): a, b = map(int, input().split()) to[a-1].append(b-1) to[b-1].append(a-1) S -= 1 T -= 1 import heapq q = [(-p[S], S)] X = p[S] a = [] v = [0] * N v[S] = 1 heapq.heapify(q) while q: t, x = heapq.heappop(q) t *= -1 qq = [x] a.append(t) # if x == T: # break while qq: u = qq.pop() for y in to[u]: if v[y] == 1: continue if p[y] >= t: qq.append(y) else: heapq.heappush(q, (-p[y], y)) v[y] = 1 ans = 0 for i in range(len(a)-1): if a[i] > a[i+1]: ans += 1 print(ans)