#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int64_t n, m, k;
  cin >> n >> m >> k;
  std::vector<int64_t> socksToColors;
  std::vector<bool> testerDFS;
  std::vector<std::set<int64_t>> graph;
  socksToColors.resize(n);
  testerDFS.resize(n);
  graph.resize(n);
  std::map<int64_t, int64_t> colors;
  for (int64_t i = 0; i < n; i++) {
    cin >> socksToColors[i];
  }
  for (int64_t i = 0; i < m; i++) {
    int64_t l, r;
    cin >> l >> r;
    r = r - 1;
    l = l - 1;
    graph[l].insert(r);
    graph[r].insert(l);
  }
  std::function<int64_t(int64_t)> dfs;
  dfs = [&](int64_t k) -> int64_t {
    testerDFS[k] = true;
    int64_t result = 1;
    int64_t color = socksToColors[k];
    auto it = colors.find(color);
    if (it == colors.end()) {
      colors.insert(it, std::make_pair(socksToColors[k], 1));
    } else {
      (*it).second++;
    }
    for (int64_t v : graph[k]) {
      if (!testerDFS[v]) {
        result += dfs(v);
      }
    }
    return result;
  };
  int64_t changeColor = 0;
  for (int i = 0; i < n; i++) {
    if (!testerDFS[i]) {
      colors.clear();
      int64_t result = 0;
      result += dfs(i);
      int64_t countMax = 0;
      for (auto& ref : colors) {
        int64_t count = ref.second;
        if (count > countMax) {
          countMax = count;
        }
      }
      changeColor += result - countMax;
    }
  }
  std::cout << changeColor << std::endl;
  return 0;
}
