#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int* sock;
int** ins;
const int N = 200010;
class DisjointSet {
 public:
  int p[N];
  void Init(int n) {
    for (int i = 1; i <= n; ++i) p[i] = i;
  }
  int Find(int x) { return x == p[x] ? x : p[x] = Find(p[x]); }
  void Union(int x, int y) { p[Find(x)] = Find(y); }
};
DisjointSet d;
int main() {
  int cnt = 0;
  cin >> n >> m >> k;
  sock = new int[n + 1];
  ins = new int*[m];
  sock[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> sock[i];
  }
  for (int i = 0; i < m; i++) {
    ins[i] = new int[2];
  }
  d.Init(n);
  for (int i = 0; i < m; i++) {
    cin >> ins[i][0];
    cin >> ins[i][1];
    if (d.Find(ins[i][0] != d.Find(ins[i][1]))) {
      d.Union(ins[i][0], ins[i][1]);
    }
  }
  map<int, vector<int> > count;
  map<int, vector<int> >::iterator it;
  for (int i = 1; i <= n; i++) {
    count[d.Find(i)].push_back(i);
  }
  for (it = count.begin(); it != count.end(); it++) {
    map<int, int> tmp;
    map<int, int>::iterator it2;
    int maxNum = -1;
    for (int i = 0; i < it->second.size(); i++) {
      tmp[sock[it->second[i]]]++;
    }
    for (it2 = tmp.begin(); it2 != tmp.end(); it2++) {
      if (it2->second > maxNum) {
        maxNum = it2->second;
      }
    }
    cnt += (it->second.size() - maxNum);
  }
  cout << cnt;
}
