#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return b * a / gcd(a, b);
}
long long int abs1(long long int a) {
  if (a < 0)
    return -1 * a;
  else
    return a;
}
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int fast_pow(long long base, long long n) {
  if (n == 0) return 1;
  if (n == 1) return base;
  long long halfn = fast_pow(base, n / 2);
  if (n % 2 == 0)
    return (halfn * halfn);
  else
    return (((halfn * halfn)) * base);
}
long long int findMMI_fermat(long long int n, long long int M) {
  return fast_pow(n, M - 2);
}
const double PI = 3.14159265358979323846;
int c[2000001];
bool b[1000001];
vector<int> x[2000001];
long long int dfs(int i) {
  stack<int> s;
  s.push(i);
  int count = 0;
  map<int, int> ma;
  while (!s.empty()) {
    int t = s.top();
    s.pop();
    if (b[t] == true) continue;
    b[t] = true;
    count++;
    ma[c[t]]++;
    for (int j = 0; j < x[t].size(); j++) {
      s.push(x[t][j]);
    }
  }
  int p = 0;
  int r = 0;
  map<int, int>::iterator it;
  for (it = ma.begin(); it != ma.end(); it++) {
    if (it->second > p) {
      r = it->first;
      p = it->second;
    }
  }
  return count - p;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  memset(b, false, sizeof(b));
  for (int i = 1; i <= n; i++) cin >> c[i];
  while (m--) {
    int a, b;
    cin >> a >> b;
    x[a].push_back(b);
    x[b].push_back(a);
  }
  int l = 0;
  for (int i = 1; i <= n; i++) {
    if (b[i] == false) {
      l += dfs(i);
    }
  }
  cout << l;
  return 0;
}
