#include <bits/stdc++.h>
using namespace std;
vector<int> g[200001];
int vis[200001];
int c[200001];
map<int, int> m;
int no;
void dfs(int i) {
  vis[i] = 1;
  no++;
  m[c[i]]++;
  for (int j = 0; j < g[i].size(); j++) {
    if (!vis[g[i][j]]) dfs(g[i][j]);
  }
}
int main() {
  int n, mm, k;
  cin >> n >> mm >> k;
  for (int i = 1; i < n + 1; i++) cin >> c[i];
  for (int i = 0; i < mm; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    if (!vis[i]) {
      no = 0;
      m.clear();
      dfs(i);
      int yo = 0;
      for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
        yo = max(it->second, yo);
      }
      ans += (no - yo);
    }
  }
  cout << ans << endl;
  return 0;
}
