#include <bits/stdc++.h>   using namespace std;   vector<vector<int>> adj;   bool vis[200000 + 9];   int cntnode;   map<int, int> colorcnt;   int c[200000 + 9];   int mx;   void dfs(int node) {     if (vis[node]) {       return;     }     cntnode++;     colorcnt[c[node]]++;     mx = max(mx, colorcnt[c[node]]);     vis[node] = 1;     for (int i = 0; i < (int)adj[node].size(); i++) {       int ch = adj[node][i];       dfs(ch);     }   }   int main() {     int n, m, k;     cin >> n >> m >> k;     adj.resize(n);     for (int i = 0; i < n; i++) {       cin >> c[i];     }     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       adj[x - 1].push_back(y - 1);       adj[y - 1].push_back(x - 1);     }     int sum = 0;     for (int i = 0; i < n; i++) {       cntnode = 0;       colorcnt.clear();       mx = 0;       if (!vis[i]) {         dfs(i);       }       sum += (cntnode - mx);     }     cout << sum;     return 0;   }   