#include <bits/stdc++.h>
using namespace std;
int pa[200200], col[200200], num[200200];
vector<int> v[200200];
map<int, int> mp;
void init(int n) {
  for (int i = 1; i <= n; i++) pa[i] = i;
}
int findset(int x) { return pa[x] == x ? x : pa[x] = findset(pa[x]); }
void unionset(int x, int y) {
  x = findset(x);
  y = findset(y);
  if (x != y) pa[y] = x;
}
int main() {
  int n, m, k, cnt = 0, ans = 0;
  scanf("%d%d%d", &n, &m, &k);
  init(n);
  for (int i = 1; i <= n; i++) scanf("%d", &col[i]);
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    unionset(l, r);
  }
  for (int i = 1; i <= n; i++)
    if (pa[i] == i) num[i] = ++cnt;
  for (int i = 1; i <= n; i++) v[num[findset(i)]].push_back(col[i]);
  for (int i = 1; i <= cnt; i++) {
    int sz = v[i].size();
    int mx = 0;
    mp.clear();
    for (int j = 0; j <= sz - 1; j++) {
      mp[v[i][j]]++;
      mx = max(mx, mp[v[i][j]]);
    }
    ans += (sz - mx);
  }
  printf("%d\n", ans);
  return 0;
}
