#include <bits/stdc++.h>
using namespace std;
vector<long long> p((long long)3e5 + 1);
long long findd(long long i) {
  if (i != p[i])
    return findd(p[i]);
  else
    return i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x, y, m, w, c, d;
  cin >> n >> m >> w;
  vector<long long> a(n + 1), b(n + 1), v[n + 1], g;
  for (long long i = 1; i <= n; i++) cin >> a[i], p[i] = i;
  for (long long i = 0; i < m; i++) {
    cin >> x >> y;
    c = findd(x);
    d = findd(y);
    if (c == d) continue;
    if (c > d) swap(c, d);
    p[d] = c;
  }
  for (long long i = 1; i <= n; i++) {
    if (p[i] == i) g.push_back(i);
    v[findd(i)].push_back(i);
  }
  long long ans = 0;
  for (long long i = 1; i <= g.size(); i++) {
    vector<long long> vv;
    for (auto x : v[g[i - 1]]) {
      vv.push_back(a[x]);
    }
    sort(vv.begin(), vv.end());
    long long x = 1, y = 1;
    for (long long i = 1; i < vv.size(); i++) {
      if (vv[i] == vv[i - 1])
        x++;
      else {
        y = max(y, x);
        x = 1;
      }
    }
    y = max(y, x);
    ans += v[g[i - 1]].size() - y;
  }
  cout << ans;
}
