#include <bits/stdc++.h>
using namespace std;
vector<long long> vec[200010];
map<long long, long long> r, p;
long long n, m, k, x, y, ans = 0, t = 0, mx = 0, mark[200010], s;
void dfs(long long u) {
  t++;
  mark[u] = 1;
  r[p[u]]++;
  if (r[p[u]] > mx) mx = r[p[u]];
  for (long long i = 0; i < vec[u].size(); i++) {
    if (!mark[vec[u][i]]) dfs(vec[u][i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> s;
  for (long long i = 1; i <= n; i++) cin >> p[i];
  for (long long i = 1; i <= m; i++) {
    cin >> x >> y;
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  for (long long i = 1; i <= n; i++) {
    if (!mark[i]) {
      t = 0;
      mx = 0;
      r.clear();
      dfs(i);
      ans += t - mx;
    }
  }
  cout << ans;
  return 0;
}
