#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
}
const int MAXN = 2e5 + 3;
int C[MAXN];
int n, m, k;
vector<int> g[MAXN];
int vis[MAXN];
int comp_sz[MAXN];
int comp[MAXN];
int cno;
int maxf = 0;
map<int, int> colf[MAXN];
void dfs(int u) {
  vis[u] = 1;
  comp[u] = cno;
  comp_sz[cno]++;
  colf[cno][C[u]]++;
  maxf = max(maxf, colf[cno][C[u]]);
  for (auto v : g[u]) {
    if (!vis[v]) {
      dfs(v);
    }
  }
}
int main(int argc, char* argv[]) {
  io();
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> C[i];
  }
  int u, v;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cno = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      cno++;
      maxf = 0;
      dfs(i);
      ans = ans + comp_sz[cno] - maxf;
    }
  }
  cout << ans << '\n';
  return 0;
}
