#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
vector<long long> v[maxn];
long long col[maxn];
bool vis[maxn];
long long cntt, mx;
map<long long, long long> mp;
void dfs(long long x) {
  vis[x] = 1;
  mp[col[x]]++;
  cntt++;
  mx = max(mx, mp[col[x]]);
  for (int i = 0; i < (int)v[x].size(); ++i) {
    long long cur = v[x][i];
    if (!vis[cur]) {
      dfs(cur);
    }
  }
}
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) {
    cin >> col[i];
  }
  for (int i = 0; i < m; ++i) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  long long t = 0;
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    cntt = 0;
    mx = 0;
    if (!vis[i]) {
      dfs(i);
      mp.clear();
      res += cntt - mx;
      t++;
    }
  }
  cout << res << endl;
}
