#include <bits/stdc++.h>
using namespace std;
int getint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int pre[212345];
int siz[212345];
int find(int x) {
  int res = x;
  while (pre[res] != res) res = pre[res];
  int t;
  while (pre[x] != res) {
    t = pre[x];
    pre[x] = res;
    x = t;
  }
  return res;
}
void un(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (x < y) swap(x, y);
  pre[x] = y;
  siz[y] += siz[x];
  return;
}
map<int, int> mp[212345];
int n, m, k;
int col[212345];
bool vis[212345];
int main() {
  n = getint();
  m = getint();
  k = getint();
  for (int i = 1; i <= n; i++) pre[i] = i, siz[i] = 1;
  for (int i = 1; i <= n; i++) col[i] = getint();
  for (int i = 1; i <= m; i++) {
    int x = getint(), y = getint();
    un(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int x = find(i);
    mp[x][col[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int mx = 0;
    int x = find(i);
    if (vis[x]) continue;
    vis[x] = 1;
    map<int, int>::iterator it;
    for (it = mp[x].begin(); it != mp[x].end(); it++) {
      mx = max(mx, it->second);
    }
    ans += (siz[x] - mx);
  }
  printf("%d\n", ans);
  return 0;
}
