#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MX = 2e5 + 2;
const long long INF = 1000000000000000000;
const long double PI = 4 * atan((long double)1);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
bool ckmin(int& a, int b) { return b < a ? a = b, true : false; }
bool ckmax(int& a, int b) { return b > a ? a = b, true : false; }
int rudiv(int a, int b) { return (a + b - 1) / b; }
void op(int ok) { cout << ok << endl; }
void op(string ok) { cout << ok << endl; }
void op(long long ok) { cout << ok << endl; }
void op(char ok) { cout << ok << endl; }
void op(double ok) { cout << fixed << setprecision(7) << ok << endl; }
void op(long double ok) { cout << fixed << setprecision(7) << ok << endl; }
void op(pair<int, int> ok) { cout << ok.first << " " << ok.second << endl; }
void op(pair<long long, long long> ok) {
  cout << ok.first << " " << ok.second << endl;
}
void op(pair<long double, long double> ok) {
  cout << ok.first << " " << ok.second << endl;
}
int n, m, k;
vector<int> currColors;
int c[MX];
vector<int> adj[MX];
int bet1, bet2;
bool visit[MX];
int ans;
int maxThing;
int currCount;
void dfs(int v) {
  visit[v] = true;
  currColors.push_back(c[v]);
  for (auto& x : adj[v]) {
    if (!visit[x]) dfs(x);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> c[i + 1];
  }
  for (int i = 0; i < m; i++) {
    cin >> bet1 >> bet2;
    adj[bet1].push_back(bet2);
    adj[bet2].push_back(bet1);
  }
  for (int i = 0; i < n; i++) {
    if (!visit[i + 1]) {
      currColors.clear();
      dfs(i + 1);
      maxThing = 0;
      currCount = 0;
      sort((currColors).begin(), (currColors).end());
      for (int j = 0; j < (int)currColors.size(); j++) {
        maxThing++;
        if (j > 0)
          if (currColors[j] != currColors[j - 1]) maxThing = 1;
        currCount = max(maxThing, currCount);
      }
      ans += (int)currColors.size() - currCount;
    }
  }
  op(ans);
  return 0;
}
