//author: лелутик :3
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <bitset>
#include <time.h>
#include <cmath>
#include <cassert>
#include <random>
#include <queue>
using namespace std;
#define int long long
#define line cout << "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define ppb pop_back
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pii pair<int, int>
const int MAXN = 2e5 + 10;
vector<int> g[MAXN];
bool used[MAXN];
const int MOD = 1e9 + 7;
int cnt = 0, cntm = 0;

void dfs(int v, int p) {
    cnt++;
    cntm += sz(g[v]);
    used[v] = true;
    for (auto &u : g[v]) {
        if (used[u]) {
            continue;
        }
        dfs(u, v);
    }
}


void solve() {
    int n, m, gg;
    cin >> n >> m >> gg;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].pb(b);
        g[b].pb(a);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!used[i]) {
            dfs(i, i);
            ans += cntm - cnt;
            cntm = 0; cnt = 0;
        }
    }
    cout << ans; line;
    cout << 0; line;
}

signed main() {
    fast;


#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif


    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}