#include <bits/stdc++.h>
using namespace std;
map<int, int> m1;
int cnt;
int dfs(vector<int> a[], int s, int vis[], int col[]) {
  cnt++;
  vis[s] = 1;
  m1[col[s]]++;
  for (int i = 0; i < a[s].size(); i++)
    if (!vis[a[s][i]]) dfs(a, a[s][i], vis, col);
  return 0;
}
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  vector<int> a[n];
  int col[n], vis[n];
  for (int i = 0; i < n; i++) {
    vis[i] = 0;
    scanf("%d", &col[i]);
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      m1.clear();
      cnt = 0;
      dfs(a, i, vis, col);
      int maxi = 0;
      for (auto j : m1) {
        maxi = max(maxi, j.second);
      }
      ans += (cnt - maxi);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
