#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<int> c;
vector<bool> visited;
map<int, int> counter;
int sum = 0, maximum = 0;
void dfs(int x) {
  ++sum;
  visited[x] = true;
  if (!counter.count(c[x])) counter[c[x]] = 0;
  ++counter[c[x]];
  maximum = max(maximum, counter[c[x]]);
  for (int i = 0; i < g[x].size(); ++i) {
    if (!visited[g[x][i]]) dfs(g[x][i]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, k;
  cin >> n >> m >> k;
  g = vector<vector<int> >(n);
  c = vector<int>(n);
  for (int i = 0; i < n; ++i) cin >> c[i];
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[v].push_back(u);
    g[u].push_back(v);
  }
  visited = vector<bool>(n, false);
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (!visited[i]) {
      dfs(i);
      res += sum - maximum;
      maximum = sum = 0;
      counter = map<int, int>();
    }
  }
  cout << res << endl;
}
