#include <bits/stdc++.h>
using namespace std;
const int INF = (unsigned)-1 >> 1;
const long long inf = (unsigned long long)-1 >> 1;
template <class T>
void rd(T &a) {
  a = 0;
  char c;
  while (c = getchar(), !isdigit(c))
    ;
  do a = a * 10 + (c ^ 48);
  while (c = getchar(), isdigit(c));
}
template <class T>
void nt(T x) {
  if (!x) return;
  nt(x / 10);
  putchar(48 + x % 10);
}
template <class T>
void pt(T x) {
  if (!x)
    putchar('0');
  else
    nt(x);
}
template <class T>
void Max(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void Min(T &a, T b) {
  if (a == -1 || a > b) a = b;
}
const int M = 2e5 + 5;
int f[M], A[M];
vector<int> G[M];
inline int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) rd(A[i]), f[i] = i;
  for (int i = 1, l, r; i <= m; ++i) {
    rd(l), rd(r);
    int f1 = find(l), f2 = find(r);
    if (f1 == f2) continue;
    f[f2] = f1;
  }
  for (int i = 1; i <= n; ++i) {
    int c = find(i);
    G[c].push_back(i);
  }
  static int cnt[M];
  memset(cnt, 0, sizeof(cnt));
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    if (G[i].size() == 0) continue;
    int c = 0, Mx = 0;
    for (int j = 0; j < G[i].size(); ++j) {
      int to = G[i][j];
      ++cnt[A[to]];
      if (cnt[A[to]] > Mx) Mx = cnt[A[to]], c = A[to];
    }
    for (int j = 0; j < G[i].size(); ++j) --cnt[A[G[i][j]]];
    int w = G[i].size();
    res += w - Mx;
  }
  cout << res << endl;
  return 0;
}
