#include <bits/stdc++.h>
using namespace std;
int fa[200010];
int vv[200010];
vector<int> vec[200010];
int res = 0;
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
int main() {
  int n, m, k, i, j;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &vv[i]);
    fa[i] = i;
  }
  int x, y;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    int t1 = find(x);
    int t2 = find(y);
    if (t1 != t2) fa[t1] = t2;
  }
  for (i = 1; i <= n; i++) vec[find(i)].push_back(vv[i]);
  for (i = 1; i <= n; i++) {
    if (vec[i].size() > 1) {
      map<int, int> mapp;
      int sum = 0;
      int max_num = -1;
      for (j = 0; j < vec[i].size(); j++) {
        sum++;
        if (!mapp[vec[i][j]])
          mapp[vec[i][j]] = 1;
        else
          mapp[vec[i][j]]++;
        max_num = max(max_num, mapp[vec[i][j]]);
      }
      res += sum - max_num;
    }
  }
  printf("%d\n", res);
}
