#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int c[N], par[N], mx[N];
map<int, int> cnt;
vector<int> v[N];
int find(int x) {
  if (x == par[x]) return x;
  return par[x] = find(par[x]);
}
void join(int x, int y) { par[find(x)] = y; }
int main() {
  int n, m, k, i, x, y;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &c[i]);
    par[i] = i;
  }
  while (m--) {
    scanf("%d %d", &x, &y);
    if (find(x) != find(y)) join(x, y);
  }
  for (i = 1; i <= n; ++i) v[find(i)].push_back(i);
  int ans = 0, mx;
  for (i = 1; i <= n; ++i) {
    if (v[i].size() > 1) {
      cnt.clear();
      mx = 0;
      for (int x : v[i]) ++cnt[c[x]];
      for (auto it = cnt.begin(); it != cnt.end(); ++it)
        mx = max(mx, it->second);
      ans += v[i].size() - mx;
    }
  }
  printf("%d\n", ans);
  return 0;
}
