#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int n, m, k;
int color[MAXN];
vector<int> graf[MAXN];
multiset<int> grupa[MAXN];
bool bio[MAXN];
int cc = 1;
int comp[MAXN];
void Dfs(int node) {
  if (bio[node]) return;
  bio[node] = true;
  comp[node] = cc;
  for (auto y : graf[node]) Dfs(y);
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> color[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    graf[u].push_back(v);
    graf[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!bio[i]) {
      Dfs(i);
      cc++;
    }
  }
  for (int i = 1; i <= n; i++) grupa[comp[i]].insert(color[i]);
  int sol = 0;
  for (int i = 1; i < cc; i++) {
    multiset<int> s;
    s.clear();
    for (auto it = grupa[i].begin(); it != grupa[i].end(); it++) s.insert(*it);
    int sada = *s.begin();
    int cnt = 1;
    int maxi = 1;
    for (auto it = s.begin(); it != s.end(); it++) {
      if (it == s.begin()) continue;
      if (*it != sada) {
        maxi = max(maxi, cnt);
        cnt = 1;
        sada = *it;
      } else
        cnt++;
    }
    if (cnt > 1) maxi = max(maxi, cnt);
    sol = sol + ((int)s.size() - maxi);
  }
  cout << sol << endl;
  return 0;
}
