#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 100;
vector<int> vec[maxn];
int a[maxn];
struct node {
  int v, next;
} edge[maxn * 10];
int du[maxn];
int head[maxn], cnt = 0, vis[maxn], belong[maxn];
void add_edge(int u, int v) {
  edge[cnt].v = v;
  edge[cnt].next = head[u];
  head[u] = cnt++;
}
void dfs(int u, int flag) {
  int v;
  vis[u] = 1;
  belong[u] = flag;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    v = edge[i].v;
    if (vis[v]) {
      continue;
    }
    dfs(v, flag);
  }
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  memset(head, -1, sizeof(head));
  memset(vis, 0, sizeof(vis));
  memset(belong, 0, sizeof(belong));
  cnt = 0;
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    int xx, yy;
    scanf("%d%d", &xx, &yy);
    add_edge(xx, yy);
    add_edge(yy, xx);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      flag++;
      dfs(i, flag);
    }
  }
  for (int i = 1; i <= n; i++) {
    vec[belong[i]].push_back(i);
  }
  memset(du, 0, sizeof(du));
  int maxx = 0;
  int sum = 0;
  for (int i = 1; i <= flag; i++) {
    int xx = vec[i].size();
    maxx = 0;
    for (int j = 0; j < xx; j++) {
      int vv = vec[i][j];
      du[a[vv]]++;
      if (maxx < du[a[vv]]) {
        maxx = du[a[vv]];
      }
    }
    sum += xx - maxx;
    for (int j = 0; j < xx; j++) {
      int vv = vec[i][j];
      du[a[vv]]--;
    }
  }
  printf("%d\n", sum);
}
