#include <bits/stdc++.h>
using namespace std;
int c[200007], vis[200007];
vector<int> G[200007], vv[200007];
void dfs(int src, int k) {
  vis[src] = k;
  for (int u : G[src]) {
    if (!vis[u]) dfs(u, k);
  }
}
int main() {
  int n, m, k;
  memset(vis, 0, sizeof vis);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) scanf("%d", c + i);
  for (int i = 0; i < m; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    G[l].push_back(r);
    G[r].push_back(l);
  }
  int kk = 1;
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      dfs(i, kk);
      ++kk;
    }
  }
  for (int i = 1; i <= n; ++i) vv[vis[i]].push_back(i);
  int ans = 0;
  for (int i = 1; i < kk; ++i) {
    int mx = 0;
    map<int, int> m;
    for (auto j : vv[i]) {
      m[c[j]]++;
      mx = max(mx, m[c[j]]);
    }
    ans += (vv[i].size() - mx);
  }
  cout << ans;
  return 0;
}
