#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int n, m, k;
int f[N];
int jihe[N];
vector<int> v[N];
int find(int x) {
  int r = x;
  while (f[r] != r) r = f[r];
  int i = x;
  int j;
  while (i != r) {
    j = f[i];
    f[i] = r;
    i = j;
  }
  return r;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    f[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    int x = find(l), y = find(r);
    if (x != y) f[x] = y;
  }
  int tol = 1;
  for (int i = 1; i <= n; i++) {
    if (f[i] == i) {
      jihe[i] = tol;
      tol++;
    }
  }
  for (int i = 1; i <= n; i++) {
    v[jihe[find(i)]].push_back(a[i]);
  }
  int sum = 0;
  for (int i = 1; i < tol; i++) {
    int m = v[i].size();
    map<int, int> st;
    int ans = 0;
    for (auto t : v[i]) {
      st[t]++;
      ans = max(ans, st[t]);
    }
    sum += m - ans;
  }
  cout << sum << endl;
  return 0;
}
