#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
void CI(int &_x) { scanf("%d", &_x); }
void CO(int &_x) { cout << _x; }
template <typename T>
void getarray(T a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void printarray(T a[], int n) {
  for (int i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
int dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};
int dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};
int dr4[4] = {0, 0, 1, -1};
int dc4[4] = {-1, 1, 0, 0};
int kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};
int kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};
int par[200005];
int find(int r) {
  if (par[r] == r)
    return r;
  else
    return par[r] = find(par[r]);
}
void Union(int a, int b) {
  int u = find(a);
  int v = find(b);
  if (u == v) return;
  par[u] = v;
}
void makeset(int n) { par[n] = n; }
int colour[200005];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> colour[i];
  }
  for (int i = 1; i <= n; i++) makeset(i);
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    Union(u, v);
  }
  map<int, int> kount[200005];
  set<int> S;
  for (int i = 1; i <= n; i++) {
    int group = find(i);
    S.insert(group);
    kount[group][colour[i]] += 1;
  }
  set<int>::iterator s;
  int ans = 0;
  for (s = S.begin(); s != S.end(); s++) {
    int group = *s;
    map<int, int>::iterator it;
    int maxi = 0;
    for (it = kount[group].begin(); it != kount[group].end(); it++) {
      ans += it->second;
      maxi = max(maxi, it->second);
    }
    ans -= maxi;
  }
  cout << ans << "\n";
  return 0;
}
