#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
const double pi = acos(-1.0);
using namespace std;
const int maxn = 2e5 + 5;
int par[maxn], num[maxn], c[maxn];
int ll[maxn], rr[maxn];
bool inq[maxn];
int N, M, K;
std::vector<int> v;
map<int, int> m;
struct Node {
  int p, id;
  bool operator<(const Node &rhs) const { return p < rhs.p; }
} node[maxn];
void init() {
  for (int i = 1; i <= N; i++) {
    par[i] = i;
    num[i] = 1;
  }
}
int findpar(int x) { return par[x] = (par[x] == x ? x : findpar(par[x])); }
void unite(int x, int y) {
  x = findpar(x), y = findpar(y);
  if (x == y) return;
  par[x] = y;
  num[y] += num[x];
}
int main() {
  cin >> N >> M >> K;
  init();
  int ii;
  for (int i = 1; i <= N; i++) ii++;
  for (int i = 1; i <= N; i++) scanf("%d", &c[i]);
  for (int i = 0; i < M; i++) {
    scanf("%d%d", &ll[i], &rr[i]);
    unite(ll[i], rr[i]);
  }
  for (int i = 1; i <= N; i++) {
    int p = findpar(i);
    node[i].id = i, node[i].p = p;
  }
  ii++;
  for (int i = 1; i <= N; i++) ii++;
  sort(node + 1, node + N + 1);
  int now = -1;
  int ans = 0, mm = -1;
  for (int i = 1; i <= N; i++) {
    if (now != -1 && mm != -1 && now != node[i].p) ans += num[now] - m[mm];
    if (now != node[i].p) {
      mm = -1;
      now = node[i].p;
      m.clear();
    }
    m[c[node[i].id]] += 1;
    if (m[c[node[i].id]] > m[mm] || mm == -1) mm = c[node[i].id];
  }
  for (int i = 1; i <= N; i++) ii++;
  ans += num[now] - m[mm];
  cout << ans << endl;
}
