#include <bits/stdc++.h>
using namespace std;
int par[200002], ch[200002], inp[200002], ckd[200002];
vector<int> v[200002];
int findpar(int i) {
  if (par[i] == i) return i;
  return par[i] = findpar(par[i]);
}
int main() {
  ios_base::sync_with_stdio(0);
  int i, j, x, n, cnt = 0, m, y, k, g, flg, vin, cn, mx;
  cin >> n >> m >> k;
  int c[n + 1];
  pair<int, int> sk[m + 1];
  for (i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (i = 1; i <= n; i++) {
    par[i] = i;
  }
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    sk[i].first = x;
    sk[i].second = y;
    par[findpar(par[x])] = findpar(par[y]);
  }
  for (i = 1; i <= n; i++) {
    par[i] = findpar(par[i]);
  }
  vin = 0;
  for (i = 1; i <= m; i++) {
    if (!ch[par[sk[i].first]]) {
      ch[par[sk[i].first]] = 1;
      inp[par[sk[i].first]] = ++vin;
    }
    if (!ckd[sk[i].first]) {
      ckd[sk[i].first] = 1;
      v[inp[par[sk[i].first]]].push_back(c[sk[i].first]);
    }
    if (!ckd[sk[i].second]) {
      ckd[sk[i].second] = 1;
      v[inp[par[sk[i].first]]].push_back(c[sk[i].second]);
    }
  }
  for (i = 1; i <= vin; i++) {
    cn = 1;
    mx = 1;
    sort(v[i].begin(), v[i].end());
    for (j = 1; j <= v[i].size() - 1; j++) {
      if (v[i][j] == v[i][j - 1]) {
        cn++;
        mx = max(cn, mx);
      } else {
        cn = 1;
      }
    }
    cnt += v[i].size() - mx;
  }
  cout << cnt;
}
