#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char s[212345];
long long sum[212345];
bool isp(long long x) {
  long long tt = sqrt(x * 1.0);
  for (long long i = 2; i <= tt; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
long long quick_mod(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = res * a;
      res %= mod;
    }
    b >>= 1;
    a = a * a;
    a %= mod;
  }
  return res;
}
long long l, r;
int vis[212345];
int n, m;
const int huan = 112345;
int f[212345];
int find(int x) {
  if (f[x] == x) return x;
  return f[x] = find(f[x]);
}
vector<int> vec[212345];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    f[i] = i;
    int tem;
    cin >> tem;
    vis[i] = tem;
  }
  int l, r;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    int xx = find(l);
    int yy = find(r);
    if (xx == yy) continue;
    f[xx] = yy;
  }
  for (int i = 1; i <= n; i++) {
    int root = find(i);
    vec[root].push_back(vis[i]);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    map<int, int> ma;
    int maxx = 0;
    for (int j = 0; j < vec[i].size(); j++) {
      ma[vec[i][j]] += 1;
      maxx = max(ma[vec[i][j]], maxx);
    }
    ans += vec[i].size() - maxx;
  }
  cout << ans << '\n';
  return 0;
}
