#include <bits/stdc++.h>
using namespace std;
const long long OO = (long long)1e18;
const int MOD = (int)1e9 + 7;
const long double Pi = 3.1415926535897932384626433832795;
const int N = (int)2e5 + 5;
const int DEBUG = 0;
vector<int> g[N];
int cnt[N], a[N], mx, sz, res = 0, n, m, k;
int visit[N];
void dfs(int u, int tp) {
  if (tp == 1) sz++;
  cnt[a[u]] += tp;
  mx = max(mx, cnt[a[u]]);
  visit[u] = tp;
  for (int i = (int)(0); i <= (int)((int)(g[u].size()) - 1); i++) {
    int v = g[u][i];
    if (visit[v] == tp) continue;
    dfs(v, tp);
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = (int)(1); i <= (int)(n); i++) cin >> a[i];
  int u, v;
  for (int i = (int)(1); i <= (int)(m); i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(visit, 0, sizeof(visit));
  memset(cnt, 0, sizeof(cnt));
  for (int i = (int)(1); i <= (int)(n); i++)
    if (visit[i] == 0) {
      mx = sz = 0;
      dfs(i, 1);
      dfs(i, -1);
      res += sz - mx;
    }
  cout << res;
}
