#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream &operator>>(istream &in, vector<T> &arr) {
  for (auto &x : arr) in >> x;
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, const vector<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const set<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, const multiset<T> &arr) {
  for (auto &x : arr) out << x << ' ';
  return out;
}
template <typename T, typename D>
istream &operator>>(istream &in, pair<T, D> &p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T, typename D>
ostream &operator<<(ostream &out, const pair<T, D> &p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <typename T, typename D>
istream &operator>>(istream &in, vector<pair<T, D> > &arr) {
  for (auto &p : arr) in >> p.first >> p.second;
  return in;
}
template <typename T, typename D>
ostream &operator<<(ostream &out, const vector<pair<T, D> > &arr) {
  for (auto &p : arr) out << p.first << ' ' << p.second << '\n';
  return out;
}
void IO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long INF = 1e18;
const int int_INF = 1e9 + 13;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const long long MOD = 1e9 + 7;
const long long MAXN = 2e5 + 13;
vector<int> root(1, -1);
int dsu_find(int u) {
  if (root[u] == u) return u;
  return root[u] = dsu_find(root[u]);
}
void dsu_unite(int a, int b) {
  a = dsu_find(a);
  b = dsu_find(b);
  if (a != b) {
    if (rand() & 1) swap(a, b);
    root[b] = a;
  }
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  root.assign(n + 1, -1);
  for (int i = 0; i <= n; ++i) root[i] = i;
  vector<int> c(n);
  cin >> c;
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    dsu_unite(l - 1, r - 1);
  }
  map<int, set<int> > g;
  for (int i = 0; i < n; ++i) g[dsu_find(i)].insert(i);
  int ans = 0;
  for (auto &[y, s] : g) {
    map<int, int> cnt;
    int maxi = 0;
    for (auto x : s) ++cnt[c[x]], maxi = max(maxi, cnt[c[x]]);
    ans += (int)s.size() - maxi;
  }
  cout << ans << '\n';
}
signed main() {
  IO();
  solve();
  return 0;
}
