#include <bits/stdc++.h>
using namespace std;
int used[200001];
int socks[200001];
bool used2[200001];
map<pair<int, int>, int> colors;
map<pair<int, int>, int>::iterator it;
int Stage = 0;
vector<vector<int> > V;
pair<int, int> P;
int MaXS = 0;
int countOfSocks = 0;
void Dfs(int v) {
  countOfSocks++;
  P.first = Stage;
  P.second = socks[v];
  colors[P]++;
  MaXS = max(MaXS, colors[make_pair(Stage, socks[v])]);
  for (int i = 0; i < V[v].size(); i++) {
    if (used[V[v][i]] != true) {
      used[V[v][i]] = true;
      Dfs(V[v][i]);
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> socks[i];
    vector<int> a;
    V.push_back(a);
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    V[l].push_back(r);
    V[r].push_back(l);
    used2[l] = true;
    used2[r] = true;
  }
  long long ans = 0;
  if (m == 0) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (used[i] == false && used2[i] == true) {
      MaXS = 0;
      countOfSocks = 0;
      used[i] = true;
      Dfs(i);
      ans += countOfSocks - MaXS;
      Stage++;
    }
  }
  cout << ans;
  return 0;
}
