#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const int mod = 1e9 + 7;
const int mo = 998244353;
const int N = 2e5 + 5;
int n, m, s, cnt, fa[N], a[N], stm[N];
vector<int> G[N];
inline int find(int x) {
  if (x == fa[x]) return x;
  return fa[x] = find(fa[x]);
}
int main() {
  n = read();
  m = read();
  s = read();
  for (int i = (1); i <= (n); i++) a[i] = read(), fa[i] = i;
  for (int i = (1); i <= (m); i++) {
    int x, y;
    x = read(), y = read();
    int tx = find(x), ty = find(y);
    if (tx == ty) continue;
    fa[tx] = ty;
  }
  for (int i = (1); i <= (n); i++) {
    int x = find(i);
    if (x == i) cnt++;
    G[x].push_back(a[i]);
  }
  int ans = 0;
  for (int i = (1); i <= (n); i++) {
    int mx = 0;
    int siz = (int)G[i].size();
    if (!siz) continue;
    for (int j = (0); j <= (siz - 1); j++) mx = max(mx, ++stm[G[i][j]]);
    for (int j = (0); j <= (siz - 1); j++) --stm[G[i][j]];
    ans += siz - mx;
  }
  printf("%d\n", ans);
  return 0;
}
