#include <bits/stdc++.h>
using namespace std;
int N, M, K;
int color[200002];
vector<int> edge[200002];
int id[200002];
int ite = 1;
int siz[200002];
map<int, int> m[200002];
int ans;
void dfs(int a) {
  if (id[a]) {
    return;
  }
  id[a] = ite;
  for (int i = 0; i < edge[a].size(); i++) {
    dfs(edge[a][i]);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  if (fopen("cf731c.in", "r")) {
    freopen("cf731c.in", "r", stdin);
    freopen("cf731c.out", "w", stdout);
  }
  cin >> N >> M >> K;
  for (int i = 0; i < N; i++) {
    cin >> color[i];
  }
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (int i = 0; i < N; i++) {
    if (id[i] == 0) {
      dfs(i);
      ite++;
    }
  }
  for (int i = 0; i < N; i++) {
    siz[id[i]]++;
    m[id[i]][color[i]]++;
  }
  for (int i = 1; i < ite; i++) {
    int mx = -1;
    for (auto it = m[i].begin(); it != m[i].end(); it++) {
      mx = max(mx, it->second);
    }
    ans += (siz[i] - mx);
  }
  cout << ans << '\n';
  return 0;
}
