#include using namespace std; int main(){ int n,m,a,b; cin >> n >> m; vector C(n),CI(n); for (int& a:C) (cin >> a),++CI[a-1]; set> P; int tm = m; while(m--){ cin >> a >> b; if (C[a-1]==C[b-1]) --CI[C[a-1]-1]; P.emplace(min(a,b),max(a,b)); } assert(P.size()==tm); int r(0); for (int a:CI) if (a) r+=a-1; cout << r << endl; }