#include <bits/stdc++.h>
void dout() { std::cout << std::endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {}
void dfs(int v, const std::vector<std::vector<int>> &g, std::vector<bool> &used,
         const std::vector<int> &color,
         std::map<int, std::set<int>> &colorCount) {
  if (used[v]) {
    return;
  }
  used[v] = true;
  colorCount[color[v]].insert(v);
  for (int u : g[v]) {
    dfs(u, g, used, color, colorCount);
  }
}
int main() {
  int nSocks, nDays, nColors;
  scanf("%d %d %d", &nSocks, &nDays, &nColors);
  std::vector<int> color(nSocks);
  for (int i = 0; i < nSocks; i++) {
    scanf("%d", &color[i]);
  }
  std::vector<std::vector<int>> g(nSocks, std::vector<int>(0));
  std::vector<bool> used(nSocks, false);
  for (int i = 0; i < nDays; i++) {
    int sock1, sock2;
    scanf("%d %d", &sock1, &sock2);
    --sock1;
    --sock2;
    if (sock1 != sock2) {
      g[sock1].push_back(sock2);
      g[sock2].push_back(sock1);
    }
  }
  int ans = 0;
  for (int i = 0; i < nSocks; i++) {
    if (used[i]) {
      continue;
    }
    std::map<int, std::set<int>> colorCount;
    dfs(i, g, used, color, colorCount);
    int max = 0;
    for (auto &pair : colorCount) {
      max = std::max(max, (int)pair.second.size());
      ans += pair.second.size();
    }
    ans -= max;
  }
  printf("%d", ans);
  return 0;
}
