#include <bits/stdc++.h>
using namespace std;
int maxx = 0;
int find(int *ar, int val) {
  if (ar[val] < 0) {
    return val;
  } else {
    ar[val] = find(ar, ar[val]);
    return ar[val];
  }
}
void unionnn(int ar[], int val1, int val2) {
  int root1 = find(ar, val1);
  int root2 = find(ar, val2);
  if (root1 == root2) {
    return;
  } else if (abs(ar[root1]) >= abs(ar[root2])) {
    ar[root1] += ar[root2];
    ar[root2] = root1;
    maxx = (abs(abs(ar[root1])) > abs(maxx) ? abs(abs(ar[root1])) : abs(maxx));
  } else {
    ar[root2] += ar[root1];
    ar[root1] = root2;
    maxx = (abs(abs(ar[root2])) > abs(maxx) ? abs(abs(ar[root2])) : abs(maxx));
  }
}
int main() {
  int n;
  int m;
  int j;
  int i;
  int k;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  scanf("%d", &k);
  ;
  int socks[n + 1];
  int unfin[n + 1];
  for (i = 1; i < n + 1; i++) {
    scanf("%d", &socks[i]);
    ;
  }
  for (i = 1; i < n + 1; i++) {
    unfin[i] = -1;
  }
  for (i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    ;
    unionnn(unfin, a, b);
  }
  std::vector<int> rootel;
  for (i = 1; i < n + 1; i++) {
    if (unfin[i] < -1) {
      rootel.push_back(i);
    }
  }
  std::vector<int> concomp[n + 1];
  for (i = 1; i < n + 1; i++) {
    if (unfin[i] < -1) {
      concomp[i].push_back(i);
    } else if (unfin[i] > 0) {
      concomp[find(unfin, i)].push_back(i);
    }
  }
  int ans = 0;
  for (i = 0; i < rootel.size(); i++) {
    map<int, int> counts;
    for (j = 0; j < concomp[rootel[i]].size(); j++) {
      int curcol = socks[concomp[rootel[i]][j]];
      if (counts.count(curcol)) {
        counts[curcol]++;
      } else {
        counts[curcol] = 1;
      }
    }
    int maxx = 0;
    for (j = 0; j < concomp[rootel[i]].size(); j++) {
      int curcol = socks[concomp[rootel[i]][j]];
      maxx =
          (abs(maxx) > abs(counts[curcol]) ? abs(maxx) : abs(counts[curcol]));
    }
    int s = concomp[rootel[i]].size();
    ans += concomp[rootel[i]].size() - maxx;
    counts.clear();
  }
  printf("%d\n", ans);
  return 0;
}
