#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e5 + 5;
const long long int INF = 1e18;
const long long int mod = 1e9 + 7;
map<long long int, long long int> col;
long long int vis[N], a[N];
vector<long long int> g[N];
long long int n, m, k, u, v, cnt = 0;
void BFS(long long int cur) {
  long long int cntx = 0, maxi = 0;
  queue<long long int> q;
  q.push(cur);
  vis[cur] = 1;
  while (q.size()) {
    cntx++;
    cur = q.front();
    q.pop();
    col[a[cur]]++;
    maxi = max(maxi, col[a[cur]]);
    for (long long int i : g[cur]) {
      if (!vis[i]) {
        vis[i] = 1;
        q.push(i);
      }
    }
  }
  cnt += (cntx - maxi);
}
int main() {
  cin >> n >> m >> k;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  while (m--) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (long long int i = 1; i <= n; i++) {
    if (!vis[i]) {
      BFS(i);
    }
    col.clear();
  }
  cout << cnt << endl;
}
