#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
vector<int> g[maxn];
int a[maxn];
bool visited[maxn];
int tot = 0, cur = 0;
unordered_map<int, int> h;
void dfs(int i, int p) {
  if (visited[i] == false) {
    tot++;
    h[a[i]]++;
    if (h[a[i]] > cur) {
      cur = h[a[i]];
    }
    visited[i] = true;
    int si = g[i].size();
    for (int j = 0; j < si; j++) {
      if (visited[g[i][j]] == false && g[i][j] != p) {
        dfs(g[i][j], i);
      }
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    visited[i] = false;
  }
  int l, r;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    g[l].push_back(r);
    g[r].push_back(l);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (visited[i] == false) {
      h.clear();
      tot = 0, cur = 0;
      dfs(i, -1);
      ans += (tot - cur);
    }
  }
  cout << ans << "\n";
}
