#include <bits/stdc++.h>
using namespace std;
int P[200000 + 7], col[200000 + 7];
int which(int a) {
  int root = a;
  while (P[root] != -1 && P[root] != root) root = P[root];
  while (P[a] != -1 && P[a] != a) {
    P[a] = root;
    a = P[a];
  }
  return root;
}
void uni(int a, int b) {
  a = which(a);
  b = which(b);
  if (a <= b)
    P[b] = a;
  else
    P[a] = b;
}
int main() {
  memset(P, -1, sizeof(P));
  int n, m, k, left, right, res = 0, best;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &col[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &left, &right);
    uni(left, right);
  }
  map<int, vector<int> > groups;
  for (int i = 1; i <= n; i++) {
    int groupId = which(i);
    groups[groupId].push_back(col[i]);
  }
  for (auto& item : groups) {
    vector<int>& group = item.second;
    map<int, int> freq;
    best = 0;
    for (int i : group) {
      freq[i]++;
      best = max(best, freq[i]);
    }
    res += group.size() - best;
  }
  printf("%d\n", res);
  return 0;
}
