#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, k, cnt, mx = 0, cc = 0;
int color[N];
bool vis[N];
int freq[N];
vector<int> adj[N];
set<int> st;
unordered_map<int, int> mp[N];
void dfs(int u) {
  cnt++;
  mp[cc][color[u]]++;
  mx = max(mx, mp[cc][color[u]]);
  vis[u] = 1;
  for (auto v : adj[u])
    if (!vis[v]) dfs(v);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &color[i]);
  int u, v;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      cc++;
      cnt = 0;
      mx = 0;
      dfs(i);
      ans += cnt - mx;
    }
  printf("%d\n", ans);
}
