#include <bits/stdc++.h>
using namespace std;
int color[200100], k, ans;
bool visit[200100];
vector<int> sock[200100];
int bfs(int src) {
  queue<int> qq;
  int i, u, v, cnt = 1, mx;
  map<int, int> colors;
  visit[src] = 1;
  qq.push(src);
  mx = ++colors[color[src]];
  while (!qq.empty()) {
    u = qq.front();
    qq.pop();
    for (i = 0; i < sock[u].size(); i++) {
      v = sock[u][i];
      if (visit[v] == 0) {
        visit[v] = 1;
        qq.push(v);
        mx = max(mx, ++colors[color[v]]);
        cnt++;
      }
    }
  }
  return cnt - mx;
}
int main() {
  int i, n, m, u, v;
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    scanf("%d", &color[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    sock[u].push_back(v);
    sock[v].push_back(u);
  }
  for (i = 1; i <= n; i++)
    if (!visit[i]) ans += bfs(i);
  cout << ans;
  return 0;
}
