#include <bits/stdc++.h>
using namespace std;
int a[200500];
vector<vector<int> > adjlist(200500);
bool vis[200500];
map<int, int> mm;
int x = 0, y = 0, z = 0;
void DFS1(int node) {
  vis[node] = true;
  z++;
  mm[a[node]]++;
  x = max(x, mm[a[node]]);
  for (int i = 0; i < adjlist[node].size(); i++) {
    int child = adjlist[node][i];
    if (!vis[child]) {
      DFS1(child);
    }
  }
}
int res = 0;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    adjlist[l].push_back(r);
    adjlist[r].push_back(l);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      mm.clear();
      DFS1(i);
      res += z - x;
      z = x = 0;
    }
  }
  cout << res << endl;
  return 0;
}
