#include using namespace std; struct unionfind{ vector p; unionfind(int N){ p = vector(N, -1); } int root(int x){ if (p[x] < 0){ return x; } else { p[x] = root(p[x]); return p[x]; } } bool same(int x, int y){ return root(x) == root(y); } void unite(int x, int y){ x = root(x); y = root(y); if (x != y){ if (p[x] < p[y]){ swap(x, y); } p[y] += p[x]; p[x] = y; } } }; int main(){ int N, M, S, T; cin >> N >> M >> S >> T; S--; T--; vector p(N); for (int i = 0; i < N; i++){ cin >> p[i]; } vector> E(N); for (int i = 0; i < M; i++){ int a, b; cin >> a >> b; a--; b--; E[a].push_back(b); E[b].push_back(a); } map> mp; for (int i = 0; i < N; i++){ mp[p[i]].push_back(i); } vector> g; for (auto P : mp){ g.push_back(P.second); } reverse(g.begin(), g.end()); int ans = 0; unionfind UF(N); vector used(N, false); for (auto gg : g){ for (int v : gg){ used[v] = true; for (int w : E[v]){ if (used[w]){ if (!UF.same(v, w)){ UF.unite(v, w); } } } } bool ok = false; for (int v : gg){ if (UF.same(v, S) && p[v] < p[S]){ ok = true; } } if (ok){ ans++; } } cout << ans << endl; }