#include <bits/stdc++.h>
using namespace std;
vector<int> b;
void dfs(int v, vector<vector<int> >& g, vector<int>& mark, vector<int>& a) {
  mark[v] = 1;
  b.push_back(a[v]);
  for (auto u : g[v]) {
    if (!mark[u]) {
      dfs(u, g, mark, a);
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<int> > g(n);
  int v, u;
  for (int i = 0; i < m; i++) {
    cin >> v >> u;
    v--;
    u--;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  vector<int> mark(n);
  mark.assign(n, 0);
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (!mark[i]) {
      b.clear();
      dfs(i, g, mark, a);
      int max = 0;
      int j = 1;
      sort(b.begin(), b.end());
      for (int i = 1; i < b.size(); i++) {
        if (b[i] == b[i - 1])
          j++;
        else {
          if (max < j) max = j;
          j = 1;
        }
      }
      if (j > max) max = j;
      ans += b.size() - max;
    }
  }
  cout << ans << "\n";
  return 0;
}
