#include <bits/stdc++.h>
const int MAXN = (int)2 * 1e5 + 2;
using namespace std;
vector<int> g[MAXN];
bool used[MAXN];
map<int, int> st;
int n, m, k, mx, cnt, a[MAXN];
void dfs(int v) {
  st[a[v]]++;
  cnt++;
  used[v] = 1;
  mx = max(mx, st[a[v]]);
  for (int i = 0; i < g[v].size(); i++)
    if (!used[g[v][i]]) dfs(g[v][i]);
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!used[i]) {
      mx = 0;
      cnt = 0;
      st.clear();
      dfs(i);
      ans += (cnt - mx);
    }
  }
  cout << ans;
}
