#include <bits/stdc++.h>
using namespace std;
vector<long long> par(200200), siz(200200);
void make_set(long long v) {
  par[v] = v;
  siz[v] = 1;
}
long long find_set(long long v) {
  if (par[v] == v) return v;
  return par[v] = find_set(par[v]);
}
void union_sets(long long a, long long b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (siz[a] > siz[b]) {
      siz[a] += siz[b];
      par[b] = a;
    } else {
      siz[b] += siz[a];
      par[a] = b;
    }
  }
}
void dfs(long long v, vector<vector<long long> > &g, vector<bool> &vis,
         vector<long long> &vec, map<long long, long long> &ma,
         long long *cnt) {
  vis[v] = true;
  ma[vec[v - 1]]++;
  (*cnt)++;
  long long size = g[v].size();
  for (long long x = 0; x < size; x++) {
    if (!vis[g[v][x]]) dfs(g[v][x], g, vis, vec, ma, cnt);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string str, str2;
  long long elm, tc, n, m;
  tc = 1;
  while (tc--) {
    long long k;
    cin >> n >> m >> k;
    vector<vector<long long> > g(n + 1);
    vector<bool> vis(n + 1, false);
    long long a, b, ans = 0;
    vector<long long> vec(n);
    for (long long x = 0; x < n; x++) cin >> vec[x];
    for (long long x = 0; x < m; x++) {
      cin >> a >> b;
      g[a].push_back(b);
      g[b].push_back(a);
    }
    for (long long x = 1; x < n + 1; x++) {
      if (!vis[x]) {
        map<long long, long long> ma;
        long long cnt = 0;
        dfs(x, g, vis, vec, ma, &cnt);
        long long maks = 0;
        for (auto i : ma) maks = max(maks, i.second);
        ans += cnt - maks;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
