#include <bits/stdc++.h>
using namespace std;
int a[200005], ap[200005];
int n, sol, m, k, x, y;
bool ook[200005], sel[200005];
vector<int> v[200005], vv;
inline void df(int nod) {
  sel[nod] = true;
  vv.push_back(nod);
  for (auto &it : v[nod])
    if (sel[it] == false) df(it);
  return;
}
int main() {
  scanf("%d %d %d\n", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d\n", &x, &y);
    ook[x] = true;
    ook[y] = true;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; ++i)
    if (ook[i] == true && sel[i] == false) {
      int x = 0;
      df(i);
      int maxy = 1;
      for (auto &it : vv) ap[a[it]]++, maxy = max(maxy, ap[a[it]]);
      for (auto &it : vv) ap[a[it]] = 0;
      sol += vv.size() - maxy;
      vv.clear();
    }
  printf("%d\n", sol);
}
