#include <bits/stdc++.h>
using namespace std;
struct grap {
  int color;
  map<int, bool> neighs;
} cols[200006];
bool visited[200006] = {false};
map<int, int> spalvosVal;
int visitedNodes = 0;
void bfs(int node) {
  visited[node] = true;
  spalvosVal[cols[node].color]++;
  visitedNodes++;
  map<int, bool>::iterator it = cols[node].neighs.begin();
  for (it; it != cols[node].neighs.end(); ++it) {
    if (!visited[it->first]) {
      bfs(it->first);
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    int col;
    cin >> col;
    cols[i].color = col;
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    cols[a].neighs[b] = true;
    cols[b].neighs[a] = true;
  }
  int answ = 0;
  for (int i = 0; i < n; i++) {
    map<int, int> occ;
    if (!visited[i]) {
      spalvosVal.clear();
      int maxxVal = 0;
      visitedNodes = 0;
      bfs(i);
      for (map<int, int>::iterator it = spalvosVal.begin();
           it != spalvosVal.end(); ++it) {
        maxxVal = max(maxxVal, it->second);
      }
      answ += (visitedNodes - maxxVal);
    }
  }
  cout << answ;
  return 0;
}
