#include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v, arr[200100], ar[200100], ans;
int par[200100];
map<int, int> mp[200100];
inline int dsu(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = dsu(par[x]);
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    par[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    par[dsu(u)] = dsu(v);
  }
  for (int i = 1; i <= n; i++) {
    ar[dsu(i)] = max(ar[dsu(i)], ++mp[dsu(i)][arr[i]]);
  }
  ans = n;
  for (int i = 1; i <= n; i++) {
    ans -= ar[i];
  }
  cout << ans << endl;
}
