#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}
  bool unionSet(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
};
signed main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  UnionFind uf(n);
  vector<int> sock(n);
  for (int i = (0); (n) > i; i++) {
    scanf("%d", &sock[i]);
  }
  for (int i = (0); (m) > i; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    uf.unionSet(a - 1, b - 1);
  }
  map<int, map<int, int>> cou;
  for (int i = (0); (n) > i; i++) {
    if (uf.data[i] < 0) {
      cou[i][sock[i]]++;
    } else
      cou[uf.root(i)][sock[i]]++;
  }
  int ret = 0;
  for (auto mp : cou) {
    int sum = 0, Max = 0;
    for (auto c : mp.second) {
      sum += c.second;
      Max = max(Max, c.second);
    }
    ret += sum - Max;
  }
  printf("%d\n", ret);
  return 0;
}
