#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
vector<int> v[maxn], conn;
int vis[maxn], c[maxn], n, edges, cycle = 0;
void reset() { memset(vis, 0, sizeof(vis)); }
void dfs(int u) {
  vis[u] = 1;
  conn.push_back(u);
  for (int i = 0; i < v[u].size(); i++) {
    int nd = v[u][i];
    if (!vis[nd]) {
      dfs(nd);
    }
  }
}
bool comp(int a, int b) { return c[a] > c[b]; }
int solve(int u) {
  conn.clear();
  dfs(u);
  sort(conn.begin(), conn.end(), comp);
  int match = 1, maxi = 1;
  for (int i = 1; i <= conn.size() - 1; i++) {
    if (c[conn[i]] != c[conn[i - 1]]) match = 0;
    maxi = max(maxi, ++match);
  }
  return conn.size() - maxi;
}
int main() {
  reset();
  int a, b, k;
  scanf("%d %d %d", &n, &edges, &k);
  ;
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 0; i < edges; i++) {
    scanf("%d %d", &a, &b);
    ;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) ans += solve(i);
  }
  printf("%d\n", ans);
}
