#include <bits/stdc++.h>
using namespace std;
using pr = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
void dfs(vvi& v, set<int>& visited, set<int>& connected, int k) {
  if (visited.count(k)) return;
  visited.insert(k);
  connected.insert(k);
  for (auto x : v[k]) dfs(v, visited, connected, x);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vi colors(n);
  for (int i = 0; i < n; i++) cin >> colors[i];
  vvi v(n);
  set<pr> usocks;
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    if (l > r) swap(l, r);
    if (usocks.count({l, r})) continue;
    usocks.insert({l, r});
    v[l].push_back(r);
    v[r].push_back(l);
  }
  int ans = 0;
  set<int> visited;
  for (int i = 0; i < n; i++) {
    set<int> connected;
    dfs(v, visited, connected, i);
    map<int, int> mp;
    for (auto x : connected) mp[colors[x]]++;
    int mx = 0;
    for (auto& p : mp) mx = max(mx, p.second);
    ans += connected.size() - mx;
  }
  cout << ans << endl;
  return 0;
}
