#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, k; scanf("%d%d%d", &n, &m, &k);
vector<int> c(n + 1);
for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
vector<int> fa(n + 1), sz(n + 1, 1);
iota(fa.begin(), fa.end(), 0);
function<int(int)> find = [&](int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); };
auto un = [&](int a, int b) {
a = find(a); b = find(b);
if (a != b) { if (sz[a] < sz[b]) swap(a, b); fa[b] = a; sz[a] += sz[b]; }
};
for (int i = 0; i < m; i++) {
int l, r; scanf("%d%d", &l, &r);
un(l, r);
}
// 每个根:颜色计数
unordered_map<int, unordered_map<int,int>> mp;
for (int i = 1; i <= n; i++) mp[find(i)][c[i]]++;
long long ans = 0;
for (auto &pr : mp) {
int total = 0, mx = 0;
for (auto &p : pr.second) { total += p.second; mx = max(mx, p.second); }
ans += total - mx;
}
printf("%lld\n", ans);
return 0;
}