#include <bits/stdc++.h>
using namespace std;
long long int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
vector<int> adj[200000 + 5];
bool vis[200000 + 5];
vector<int> c(200000 + 5);
map<int, int> fre;
void dfs(int cv) {
  vis[cv] = true;
  fre[c[cv]]++;
  for (auto i : adj[cv]) {
    if (!vis[i]) {
      dfs(i);
    }
  }
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    adj[l].push_back(r);
    adj[r].push_back(l);
  }
  memset(vis, false, sizeof(vis));
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      fre.clear();
      dfs(i);
      int high = -1, socks = 0;
      for (auto j : fre) {
        socks += j.second;
        high = max(high, j.second);
      }
      ans += socks - high;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
