#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
  vector<int> myRank, parent;
  vector<vector<int> > str;
  int forests;
  UnionFind(int n) {
    myRank.resize(n);
    parent.resize(n);
    str.resize(n);
    forests = n;
    for (int i = 0; i < n; i++) {
      myRank[i] = 1;
      parent[i] = i;
      str[i].push_back(i);
    }
  }
  int find_parent(int x) {
    if (parent[x] == x) return x;
    return parent[x] = find_parent(parent[x]);
  }
  void link(int x, int y) {
    if (myRank[x] > myRank[y]) {
      parent[y] = x;
      for (int i = 0; i < (int)str[y].size(); i++) {
        str[x].push_back(str[y][i]);
      }
      str[y].clear();
    } else if (myRank[x] == myRank[y]) {
      parent[y] = x;
      myRank[x]++;
      for (int i = 0; i < (int)str[y].size(); i++) {
        str[x].push_back(str[y][i]);
      }
      str[y].clear();
    } else {
      parent[x] = y;
      for (int i = 0; i < (int)str[x].size(); i++) {
        str[y].push_back(str[x][i]);
      }
      str[x].clear();
    }
  }
  void union_sets(int x, int y) {
    x = find_parent(x);
    y = find_parent(y);
    if (x != y) {
      link(x, y);
      forests--;
    }
  }
};
vector<int> vec[200201];
int col[200201];
map<int, int> mapy;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, k, c1, c2;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> col[i];
  }
  UnionFind lis(n);
  for (int i = 0; i < m; i++) {
    cin >> c1 >> c2;
    lis.union_sets(c1 - 1, c2 - 1);
  }
  int counter = 0;
  for (int i = 0; i < n; i++) {
    if (i == lis.find_parent(i)) {
      for (int j = 0; j < (int)lis.str[i].size(); j++) {
        mapy[col[lis.str[i][j]]]++;
      }
      int maxi = 0;
      for (int j = 0; j < (int)lis.str[i].size(); j++) {
        maxi = max(maxi, mapy[col[lis.str[i][j]]]);
      }
      counter += ((int)lis.str[i].size() - maxi);
      mapy.clear();
    }
  }
  cout << counter;
  return 0;
}
