#include <bits/stdc++.h>
using namespace std;
int nrNodes, nrMax;
int color[200005], nrColor[200005];
vector<int> socks;
vector<int> G[200005];
bool vis[200005];
void dfs(int);
int main() {
  int i, n, m, k, a, b, ans;
  cin >> n >> m >> k;
  for (i = 1; i <= n; ++i) cin >> color[i];
  for (i = 1; i <= m; ++i) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (ans = 0, i = 1; i <= n; ++i)
    if (!vis[i]) {
      nrNodes = nrMax = 0;
      dfs(i);
      ans += nrNodes - nrMax;
      for (const auto &sock : socks) {
        nrColor[color[sock]]--;
      }
      socks.clear();
    }
  cout << ans << '\n';
  return 0;
}
void dfs(int v) {
  ++nrNodes;
  vis[v] = true;
  socks.push_back(v);
  nrColor[color[v]]++;
  if (nrColor[color[v]] > nrMax) nrMax = nrColor[color[v]];
  for (const auto &to : G[v]) {
    if (!vis[to]) {
      dfs(to);
    }
  }
}
