#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long MOD = 1e9 + 7;
const long long zero = 0;
const long long maxn = 2e5 + 5;
long long n, m, k, fr, to, c[maxn], ans, t, mx, num;
vector<long long> adj[maxn];
bool visited[maxn];
map<pair<long long, long long>, long long> cnt;
void dfs(long long v) {
  visited[v] = 1;
  cnt[{c[v], num}]++;
  t++;
  mx = max(mx, cnt[{c[v], num}]);
  for (int i = 0; i < adj[v].size(); i++) {
    if (!visited[adj[v][i]]) {
      dfs(adj[v][i]);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    cin >> fr >> to;
    adj[fr].push_back(to);
    adj[to].push_back(fr);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      num++;
      mx = 1;
      t = 0;
      dfs(i);
      ans += t - mx;
    }
  }
  cout << ans << endl;
}
