#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> a[maxn];
int check[maxn] = {0};
int color[maxn];
queue<int> q;
int n, m, k, u, v;
int bfs(int x) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int maxn = 0;
  int spt = 1;
  map<int, int> dem;
  check[x] = 1;
  q.push(x);
  dem[color[x]] += 1;
  maxn = max(maxn, dem[color[x]]);
  while (!q.empty()) {
    int e = q.front();
    q.pop();
    for (int i = 0; i < a[e].size(); i++) {
      int it = a[e][i];
      if (check[it] == 0) {
        check[it] = 1;
        q.push(it);
        ++spt;
        dem[color[it]] += 1;
        maxn = max(maxn, dem[color[it]]);
      }
    }
  }
  return spt - maxn;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> color[i];
  vector<int> b;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    b.push_back(u);
    a[u].push_back(v);
    a[v].push_back(u);
  }
  int sum = 0;
  for (int i = 0; i < b.size(); i++) {
    if (check[b[i]] == 0) sum += bfs(b[i]);
  }
  cout << sum;
}
