#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator+(ostream& out, const vector<T>& vec) {
  for (const auto& x : vec) {
    out << x << " ";
  }
  out << "\n";
  return out;
}
template <typename T>
ostream& operator*(ostream& out, const vector<T>& vec) {
  for (const auto& x : vec) {
    out + x;
  }
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& vec) {
  for (auto& x : vec) {
    in >> x;
  }
  return in;
}
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
int c[N];
unordered_map<long long, long long> cnt;
int vis[N];
vector<int> g[N];
long long ma = 0;
long long nodes = 0;
void dfs(int u) {
  vis[u] = 1;
  nodes++;
  cnt[c[u]]++;
  ma = max(cnt[c[u]], ma);
  for (auto i : g[u]) {
    if (!vis[i]) {
      dfs(i);
    }
  }
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    g[l].push_back(r);
    g[r].push_back(l);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ma = 0;
    nodes = 0;
    if (!vis[i]) {
      dfs(i);
      cnt.clear();
      ans += nodes - ma;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
