#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 private:
  int* parent;
  int* height;
  int capacity;
  int nodes;

 public:
  int Nodes() { return nodes; }

 public:
  UnionFind() {
    capacity = 15;
    nodes = 0;
    parent = new int[capacity];
    height = new int[capacity];
  }
  UnionFind(int _c) {
    int i;
    capacity = _c;
    nodes = _c;
    parent = new int[capacity];
    height = new int[capacity];
    for (i = 0; i < _c; i++) {
      parent[i] = i;
      height[i] = 0;
    }
  }
  int Find(int num) {
    if (parent[num] == num) return num;
    return Find(parent[num]);
  }
  void Link(int num1, int num2) {
    int root1 = Find(num1);
    int root2 = Find(num2);
    if (root1 == root2) return;
    if (height[root1] < height[root2])
      parent[root1] = root2;
    else if (height[root1] > height[root2])
      parent[root2] = root1;
    else {
      parent[root2] = root1;
      height[root1]++;
    }
    nodes--;
  }
  bool Connected(int num1, int num2) { return Find(num1) == Find(num2); }
};
int main() {
  unordered_map<int, vector<int>> groups;
  unordered_map<int, int> groupColor;
  set<int> groupKind;
  set<int> headers;
  int numSocks;
  int days;
  int colors;
  cin >> numSocks >> days >> colors;
  UnionFind u(numSocks);
  vector<int> sockColor(numSocks);
  vector<vector<int>> schedule;
  int i;
  int s1, s2;
  int index;
  int max;
  int groupSize;
  int n;
  int output = 0;
  for (i = 0; i < numSocks; i++) cin >> sockColor[i];
  for (i = 0; i < days; i++) {
    cin >> s1 >> s2;
    u.Link(s1 - 1, s2 - 1);
  }
  for (i = 0; i < numSocks; i++) {
    index = u.Find(i);
    headers.insert(index);
    vector<int>& v = groups[index];
    v.push_back(sockColor[i] - 1);
  }
  for (auto it = headers.begin(); it != headers.end(); it++) {
    groupColor.clear();
    groupKind.clear();
    vector<int>& v = groups[*it];
    groupSize = v.size();
    for (i = 0; i < groupSize; i++) {
      groupColor[v[i]]++;
      groupKind.insert(v[i]);
    }
    max = 0;
    for (auto ij = groupKind.begin(); ij != groupKind.end(); ij++) {
      if (groupColor[*ij] > max) max = groupColor[*ij];
    }
    output += groupSize - max;
  }
  cout << output;
  return 0;
}
