#include <bits/stdc++.h>
using namespace std;
int n, m, k, cnt, ans, mx;
int d[200005] = {0}, clr[200005];
vector<vector<int> > g;
pair<int, int> c[200005];
void dfs(int i, int t) {
  d[i] = 1;
  cnt++;
  if (c[clr[i]].second != t) {
    c[clr[i]].first = 1;
    c[clr[i]].second = t;
  } else
    c[clr[i]].first++;
  mx = max(mx, c[clr[i]].first);
  for (int j = 0; j < g[i].size(); j++) {
    if (d[g[i][j]] != 1) dfs(g[i][j], t);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  g.resize(n + 1);
  int a, b;
  for (int i = 1; i < n + 1; i++) scanf("%d", &clr[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < 200005; i++) c[i].first = c[i].second = 0;
  int t = 1;
  for (int i = 1; i < n + 1; i++) {
    cnt = 0;
    mx = 0;
    if (d[i] == 0 && g[i].size() != 0) {
      dfs(i, t);
      t++;
    }
    ans += (cnt - mx);
  }
  cout << ans << endl;
  return 0;
}
