#include <bits/stdc++.h>
using namespace std;
const int N = 202020;
int n, m, k, ans, vis[N], color[N], cnt, maxC;
map<int, int> d;
vector<int> g[N];
void dfs(int u) {
  vis[u] = 1;
  cnt++;
  d[color[u]]++;
  maxC = max(maxC, d[color[u]]);
  for (auto v : g[u]) {
    if (vis[v] == 0) dfs(v);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> k;
  for (int i = (1); i <= (n); ++i) cin >> color[i];
  for (int i = (1); i <= (m); ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  ans = 0;
  for (int i = (1); i <= (n); ++i)
    if (vis[i] == 0) {
      d.clear();
      cnt = maxC = 0;
      dfs(i);
      ans += cnt - maxC;
    }
  cout << ans;
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
