#include <bits/stdc++.h>
using namespace std;
int c[200005], f[200005];
int fin(int x) {
  if (x != f[x]) {
    f[x] = fin(f[x]);
  }
  return f[x];
}
void unit(int x, int y) {
  int fx = fin(x);
  int fy = fin(y);
  if (fx != fy) {
    f[fx] = fy;
  }
}
vector<int> p[200005];
int main() {
  int n, m, k;
  int l, r;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    f[i] = i;
  }
  while (m--) {
    scanf("%d%d", &l, &r);
    unit(l, r);
  }
  for (int i = 1; i <= n; i++) {
    p[fin(i)].push_back(c[i]);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (p[i].size() > 1) {
      int mx = 0;
      map<int, int> cut;
      for (int j = 0; j < p[i].size(); j++) {
        cut[p[i][j]]++;
        mx = max(mx, cut[p[i][j]]);
      }
      ans += (p[i].size() - mx);
    }
  }
  printf("%d\n", ans);
  return 0;
}
