#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793;
int pre[200008];
int a[200008];
vector<int> v[200008];
int Find(int x) {
  int r = x;
  while (pre[r] != r) {
    r = pre[r];
  }
  int i = x, j;
  while (pre[i] != r) {
    j = pre[i];
    pre[i] = r;
    i = j;
  }
  return r;
}
void mix(int x, int y) {
  int fx = Find(x);
  int fy = Find(y);
  if (fx != fy) {
    pre[fy] = fx;
  }
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pre[i] = i;
  }
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    mix(x, y);
  }
  for (int i = 1; i <= n; i++) {
    v[Find(i)].push_back(a[i]);
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i].size() <= 1) continue;
    int cnt = 0, pp = 0;
    map<int, int> p;
    for (int j = 0; j < v[i].size(); j++) {
      p[v[i][j]]++;
      cnt = max(cnt, p[v[i][j]]);
      pp++;
    }
    sum += pp - cnt;
  }
  printf("%d\n", sum);
  return 0;
}
