#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int fa[200005];
map<int, int> col[200005];
int ycol[200005];
bool vis[200005];
int sum = 0;
void init() {
  for (int i = 0; i <= n; i++) fa[i] = i;
}
int getfa(int x) {
  if (fa[x] == x) return x;
  return fa[x] = getfa(fa[x]);
}
void unio(int x, int y) { fa[getfa(x)] = getfa(y); }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  init();
  for (int i = 1; i <= n; i++) scanf("%d", &ycol[i]);
  int a, b;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    unio(a, b);
  }
  for (int i = 1; i <= n; i++) col[getfa(i)][ycol[i]]++;
  for (int i = 1; i <= n; i++) {
    if (vis[getfa(i)]) continue;
    vis[getfa(i)] = 1;
    int maxz = -1;
    int siz = 0;
    int f = getfa(i);
    for (map<int, int>::iterator i = col[f].begin(); i != col[f].end(); i++) {
      siz += i->second;
      maxz = max(maxz, i->second);
    }
    sum += (siz - maxz);
  }
  printf("%d\n", sum);
  return 0;
}
