#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 18;
int tests, current_case;
int n, q, k, a[N];
vector<int> v[N];
map<int, int> m;
int max_value, cnt;
long long ans;
bool used[N];
vector<int> g[N];
void message(int current_case) {
  fprintf(stderr, "Case %d solved!\n", current_case);
}
void dfs(int node) {
  used[node] = true;
  ++cnt;
  ++m[a[node]];
  max_value = max(max_value, m[a[node]]);
  for (int i = 0; i < (int)(v[node].size()); i++)
    if (!used[v[node][i]]) dfs(v[node][i]);
}
int main() {
  int i, j, x, y;
  tests = 1;
  for (current_case = 1; current_case <= tests; current_case++) {
    scanf("%d %d %d", &n, &q, &k);
    for (i = 1; i <= n; i++) scanf("%d", &a[i]), g[a[i]].push_back(i);
    while (q--) {
      scanf("%d %d", &x, &y);
      if (1) {
        v[x].push_back(y);
        v[y].push_back(x);
      }
    }
    for (i = 1; i <= n; i++) {
      if (!used[i]) {
        m.clear();
        max_value = 0;
        cnt = 0;
        dfs(i);
        ans += cnt - max_value;
      }
    }
    printf("%lld\n", ans);
    message(current_case);
  }
  return 0;
}
