#include <bits/stdc++.h>
using namespace std;
int sock[200005];
int f[200005];
int vis[200005];
vector<int> v[200005];
map<int, int> mm;
int cnt = 0;
void dfs(int x) {
  if (vis[x] == 1) return;
  vis[x] = 1;
  mm[sock[x]]++;
  cnt = max(cnt, mm[sock[x]]);
  for (int i = 0; i < v[x].size(); i++) dfs(v[x][i]);
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &sock[i]);
  for (int i = 0; i < m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    v[l].push_back(r);
    v[r].push_back(l);
  }
  int tmp = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      cnt = 0;
      mm.clear();
      dfs(i);
      tmp += cnt;
    }
  }
  printf("%d\n", n - tmp);
  return 0;
}
