#include <bits/stdc++.h>
using namespace std;
struct node {
  int v;
  node *next;
} edge[200000 * 2 + 10], *adj[200000 + 10], *ecnt = &edge[0];
int n, m, k, col[200000 + 10], cnt[200000 + 10], ans;
int b[200000 + 10], cntb;
bool vis[200000 + 10];
queue<int> que;
template <class T>
void Read(T &x) {
  char c;
  while (c = getchar(), c != EOF)
    if (c >= '0' && c <= '9') {
      x = c - '0';
      while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
      ungetc(c, stdin);
      return;
    }
}
inline void addedge(int u, int v) {
  node *p = ++ecnt;
  p->v = v;
  p->next = adj[u];
  adj[u] = p;
}
void read() {
  int x, y;
  Read(n), Read(m), Read(k);
  for (int i = 1; i <= n; i++) Read(col[i]);
  for (int i = 1; i <= m; i++) {
    Read(x), Read(y);
    addedge(x, y), addedge(y, x);
  }
}
void Bfs(int u) {
  que.push(u);
  vis[u] = true;
  int mx = ++cnt[col[u]], tot = 0;
  cntb = 0;
  while (!que.empty()) {
    u = que.front();
    que.pop();
    b[++cntb] = u;
    tot++;
    for (node *p = adj[u]; p; p = p->next)
      if (!vis[p->v]) {
        vis[p->v] = true;
        que.push(p->v);
        mx = max(mx, ++cnt[col[p->v]]);
      }
  }
  ans += tot - mx;
  for (int i = 1; i <= cntb; i++) cnt[col[b[i]]] = 0;
}
void solve() {
  for (int i = 1; i <= n; i++)
    if (!vis[i]) Bfs(i);
  printf("%d\n", ans);
}
int main() {
  read();
  solve();
  return 0;
}
