#include <bits/stdc++.h>
using namespace std;
long long fad, n, m, k, a, b, x, y, i, j, ar[2000005], sum, ans, comnt[2000005],
    pam[2000005];
set<long long> s;
set<long long>::iterator it;
vector<long long> ve[2000005];
long long find(long long x) {
  if (pam[x] == x) return x;
  return pam[x] = find(pam[x]);
}
int main() {
  cin >> n >> m >> k;
  for (i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (i = 1; i <= n; i++) {
    pam[i] = i;
  }
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    x = find(a);
    y = find(b);
    if (x != y) {
      pam[x] = pam[y];
    }
  }
  for (i = 1; i <= n; i++) {
    x = find(i);
    ve[x].push_back(ar[i]);
    s.insert(x);
  }
  for (it = s.begin(); it != s.end(); ++it) {
    x = *it;
    ans = 0;
    for (j = 0; j < ve[x].size(); j++) {
      comnt[ve[x][j]]++;
      if (comnt[ve[x][j]] > ans) {
        ans = comnt[ve[x][j]];
      }
    }
    for (j = 0; j < ve[x].size(); j++) {
      comnt[ve[x][j]] = 0;
    }
    sum += (ve[x].size() - ans);
  }
  cout << sum;
  return 0;
}
