#include <bits/stdc++.h>
using namespace std;
int color[200010];
vector<int> save[200010];
int mark[200010];
map<long long, long long> mark_color;
int main() {
  int n, m, k, cnt = 0;
  scanf("%d %d %d", &n, &m, &k);
  memset(mark, 0, sizeof(mark));
  for (int i = (1); i < (n + 1); i++) scanf("%d", &color[i]);
  for (int ca = (0); ca < (m); ca++) {
    int l, r;
    scanf("%d %d", &l, &r);
    save[min(l, r)].push_back(max(l, r));
    save[max(l, r)].push_back(min(l, r));
  }
  long long ans = 0;
  for (int i = (1); i < (n + 1); i++) {
    if (mark[i]) continue;
    mark_color.clear();
    queue<int> Q;
    Q.push(i);
    mark_color[color[i]]++;
    while (!Q.empty()) {
      int now = Q.front();
      Q.pop();
      int size = save[now].size();
      mark[now] = 1;
      for (int j = (0); j < (size); j++) {
        int iterm = save[now][j];
        if (mark[iterm]) continue;
        mark_color[color[iterm]]++;
        mark[iterm] = 1;
        Q.push(iterm);
      }
    }
    long long temp = 0;
    long long maxnum = 0;
    for (auto it = mark_color.begin(); it != mark_color.end(); it++) {
      maxnum = max(maxnum, it->second);
      temp += it->second;
    }
    ans += (temp - maxnum);
  }
  printf("%lld\n", ans);
  return 0;
}
