#include <bits/stdc++.h>
using namespace std;
map<long, long> cmap;
map<long, long>::iterator it;
bool visit[200005];
long c[200005];
vector<long> graph[200005];
long res = 0, mac, counter;
void DFS(long node);
int main(void) {
  long long n, m, k, i, l, r, j;
  cin >> n >> m >> k;
  memset(visit, false, sizeof(visit));
  for (i = 1; i <= n; i++) cin >> c[i];
  for (i = 1; i <= m; i++) {
    cin >> l >> r;
    graph[l].push_back(r);
    graph[r].push_back(l);
  }
  for (i = 1; i <= n; i++) {
    if (!visit[i]) {
      mac = 0;
      counter = 0;
      DFS(i);
      for (it = cmap.begin(); it != cmap.end(); it++) {
        mac = max(mac, it->second);
      }
      res += counter - mac;
      cmap.clear();
    }
  }
  cout << res;
  return 0;
}
void DFS(long node) {
  visit[node] = true;
  counter++;
  cmap[c[node]]++;
  long j, i;
  for (i = 0; i < graph[node].size(); i++) {
    j = graph[node][i];
    if (!visit[j]) DFS(j);
  }
}
