#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int res;
vector<int> col;
vector<vector<int> > g;
vector<bool> used;
map<int, int> ma;
inline int dfs(int v) {
  int ret = 1;
  used[v] = 1;
  ma[col[v]]++;
  for (auto u : g[v]) {
    if (!used[u]) {
      ret += dfs(u);
    }
  }
  res = max(res, ma[col[v]]);
  return ret;
}
int main() {
  cin >> n >> m >> k;
  col.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> col[i];
  }
  g.resize(n);
  int fr, to;
  for (int i = 0; i < m; ++i) {
    cin >> fr >> to;
    --fr, --to;
    g[fr].push_back(to);
    g[to].push_back(fr);
  }
  int ans = 0;
  used.resize(n);
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      res = 0;
      ma.clear();
      auto tmp = dfs(i);
      ans += (tmp - res);
    }
  }
  cout << ans;
  return 0;
}
