#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 5;
int n, m, k, c[MAX_N], fa[MAX_N], maxn[MAX_N], ans;
map<int, map<int, int> > mp;
int findFa(int x) { return fa[x] == x ? x : fa[x] = findFa(fa[x]); }
void solve() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", c + i);
    fa[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    fa[findFa(l)] = findFa(r);
  }
  for (int i = 1; i <= n; i++) {
    int f = findFa(i);
    maxn[f] = max(maxn[f], ++mp[f][c[i]]);
  }
  ans = n;
  for (int i = 1; i <= n; i++) {
    if (findFa(i) == i) ans -= maxn[i];
  }
  printf("%d", ans);
}
int main() {
  solve();
  return 0;
}
