#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = 2e5 + 5, INF = 1e9 + 5;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, m, k, c[N], ans;
struct edge {
  int v, w, ne;
} e[M << 1];
int h[N], cnt = 0;
inline void ins(int u, int v) {
  cnt++;
  e[cnt].v = v;
  e[cnt].ne = h[u];
  h[u] = cnt;
  cnt++;
  e[cnt].v = u;
  e[cnt].ne = h[v];
  h[v] = cnt;
}
int vis[N], size;
int a[N], p;
void dfs(int u) {
  a[++p] = c[u];
  vis[u] = 1;
  size++;
  for (int i = h[u]; i; i = e[i].ne) {
    int v = e[i].v;
    if (vis[v]) continue;
    dfs(v);
  }
}
int main() {
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= n; i++) c[i] = read();
  for (int i = 1; i <= m; i++) ins(read(), read());
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      size = 0;
      p = 0;
      dfs(i);
      sort(a + 1, a + 1 + p);
      int len = 1, mx = 0;
      for (int i = 1; i <= p; i++) {
        if (a[i] == a[i + 1])
          len++;
        else
          mx = max(mx, len), len = 1;
        a[i] = 0;
      }
      ans += size - mx;
    }
  printf("%d", ans);
}
