#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int c[N], f[N], n, m, k;
vector<int> e[N];
int find(int u) { return u == f[u] ? u : f[u] = find(f[u]); }
int main() {
  while (scanf("%d%d%d", &n, &m, &k) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &c[i]);
      f[i] = i;
    }
    for (int i = 1; i <= m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      int fx = find(x);
      int fy = find(y);
      if (fx != fy) f[fx] = fy;
    }
    for (int i = 1; i <= n; i++) {
      int k = find(i);
      if (k != i) e[k].push_back(i);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      map<int, int> cnt;
      int l = e[i].size(), ma = 1;
      cnt[c[i]]++;
      for (int j = 0; j < l; j++) {
        int t = e[i][j];
        cnt[c[t]]++;
        ma = max(cnt[c[t]], ma);
      }
      ans += l + 1 - ma;
    }
    printf("%d\n", ans);
  }
  return 0;
}
