#include <bits/stdc++.h>
using namespace std;
vector<int> g[212345];
int color[212345];
bool vis[212345];
map<int, int> m;
int r = 0;
int dfs(int i) {
  if (vis[i]) return 0;
  vis[i] = true;
  m[color[i]]++;
  if (m[r] < m[color[i]]) r = color[i];
  int cont = 0;
  for (int v : g[i]) {
    cont += dfs(v);
  }
  return 1 + cont;
}
int solve(int i) {
  r = -1;
  m[-1] = 0;
  int cont = dfs(i);
  int rr = cont - m[r];
  m.clear();
  return rr;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) cin >> color[i];
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    g[l].push_back(r);
    g[r].push_back(l);
  }
  memset(vis, false, sizeof vis);
  int cont = 0;
  for (int i = 0; i < n; ++i) {
    if (vis[i]) continue;
    cont += solve(i);
  }
  cout << cont << endl;
  return 0;
}
