#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 10;
vector<int> adj[N];
vector<int> tot(N, 0);
vector<int> vis(N, 0);
void solve() {
  int n, m, k;
  scanf("%d", &n), scanf("%d", &m), scanf("%d", &k);
  vector<int> color(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> color[i];
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d", &x), scanf("%d", &y);
    --x, --y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i] && adj[i].size() > 0) {
      queue<int> q;
      unordered_set<int> s;
      q.push(i);
      vis[i] = 1;
      int cnt = 0, val = 0;
      while (!q.empty()) {
        cnt++;
        int node = q.front();
        q.pop();
        tot[color[node]]++;
        s.insert(color[node]);
        val = max(tot[color[node]], val);
        for (auto child : adj[node]) {
          if (!vis[child]) {
            q.push(child);
            vis[child] = 1;
          }
        }
      }
      ans += (cnt - val);
      for (auto x : s) {
        tot[x] = 0;
      }
    }
  }
  printf("%d\n", ans);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
