#include <bits/stdc++.h>
using namespace std;
const int MAX = 2000 * 100;
vector<int> adj[MAX + 5];
int col[MAX + 5];
pair<int, int> amo[MAX + 5];
int siz, ma, ans, cnt;
bool vis[MAX + 5];
void dfs(int v) {
  vis[v] = 1;
  siz++;
  if (amo[col[v]].second != cnt)
    amo[col[v]].first = 0, amo[col[v]].second = cnt, amo[col[v]].first++;
  else
    amo[col[v]].first++, amo[col[v]].second = cnt;
  ma = max(ma, amo[col[v]].first);
  for (int u : adj[v]) {
    if (!vis[u]) dfs(u);
  }
}
int main() {
  int n, m, k, a, b;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> col[i];
  for (int i = 1; i <= m; i++)
    cin >> a >> b, adj[a].push_back(b), adj[b].push_back(a);
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ma = -1, siz = 0;
      dfs(i);
      ans += siz - ma;
      cnt++;
    }
  }
  cout << ans << "\n";
  return 0;
}
