#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int n, m, k, x, y, v[N], fa[N], mx[N], ans;
map<int, int> mp[N];
inline int ask(int x) { return fa[x] == x ? x : fa[x] = ask(fa[x]); }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]), fa[i] = i;
  for (int i = 1; i <= m; ++i) scanf("%d%d", &x, &y), fa[ask(x)] = ask(y);
  for (int i = 1; i <= n; ++i) mx[ask(i)] = max(mx[ask(i)], ++mp[ask(i)][v[i]]);
  ans = n;
  for (int i = 1; i <= n; ++i) ans -= mx[i];
  printf("%d", ans);
  return 0;
}
