#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int pre[maxn], c[maxn];
vector<int> a[maxn];
vector<int> s;
map<int, int> vis;
int find(int x) { return pre[x] == x ? x : pre[x] = find(pre[x]); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) pre[i] = i;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    pre[find(l)] = find(r);
  }
  for (int i = 1; i <= n; i++) {
    if (pre[i] == i) s.push_back(i);
    a[find(i)].push_back(c[i]);
  }
  long long cnt = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if (a[s[i]].size() <= 1) continue;
    vis.clear();
    int index = s[i];
    int maxx = 0;
    for (int j = 0; j < (int)a[index].size(); j++) {
      vis[a[index][j]]++;
      maxx = max(maxx, vis[a[index][j]]);
    }
    cnt += a[index].size() - maxx;
  }
  cout << cnt << endl;
  return 0;
}
