#include <bits/stdc++.h>
using namespace std;
map<int, int> m1, m2;
int ans = 0;
bool visited[200005];
vector<int> v1;
vector<int> v[200005];
void dfs(int s) {
  v1.push_back(s);
  m2[m1[s]]++;
  if (ans < m2[m1[s]]) ans = m2[m1[s]];
  visited[s] = true;
  int i;
  for (i = 0; i < v[s].size(); i++) {
    if (!visited[v[s][i]]) {
      visited[v[s][i]] = true;
      dfs(v[s][i]);
    }
  }
}
int main() {
  int n, m, k, x, y, c = 0, i;
  cin >> n >> m >> k;
  int a[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    m1[i] = a[i];
  }
  for (i = 0; i < m; ++i) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (!visited[i]) {
      dfs(i);
      c += v1.size() - ans;
      m2.clear();
      v1.clear();
      ans = 0;
    }
  }
  cout << c << endl;
}
