#include <bits/stdc++.h>
using namespace std;
long long parent[200001], Size[200001];
long long find_set(long long x) {
  if (x == parent[x]) return x;
  return parent[x] = find_set(parent[x]);
}
void Union(long long x, long long y) {
  x = find_set(x);
  y = find_set(y);
  if (x != y) {
    if (Size[x] > Size[y]) {
      parent[y] = parent[x];
      Size[x] += Size[y];
    } else {
      parent[x] = parent[y];
      Size[y] += Size[x];
    }
  }
}
signed main() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    parent[i] = i;
    Size[i] = 1;
  }
  long long color[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> color[i];
  }
  vector<pair<long long, long long>> vp;
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    Union(x, y);
    vp.push_back(make_pair(x, y));
  }
  vector<long long> res[n + 1];
  for (long long i = 1; i <= n; i++) {
    long long p = find_set(i);
    res[p].push_back(color[i]);
  }
  map<long long, long long> mp;
  long long ans = 0;
  long long c = INT_MIN;
  for (long long i = 1; i <= n; i++) {
    if (res[i].size() != 0) {
      c = INT_MIN;
      for (long long j = 0; j < (long long)res[i].size(); j++) {
        mp[res[i][j]]++;
      }
      for (auto i = mp.begin(); i != mp.end(); i++) {
        c = max(c, i->second);
      }
      ans += Size[i] - c;
      mp.clear();
    }
  }
  cout << ans;
}
