#ifdef LOCAL
#pragma optimize("", off)
#include "localstd1.h"
#else
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/allocator.h>
#pragma GCC target("avx2,bmi,bmi2")
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define all(a) (a).begin(), (a).end()

struct Node {
	vector<int> e;
	bitset<2000> banned{};
	int vers = -1;
};
vector<Node> graph;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n, m, g; cin >> n >> m >> g;
	graph.assign(n, {});
	for (int i = 0; i < m; i++) {
		int u, v; cin >> u >> v; u--; v--;
		graph[u].e.push_back(v);
	}

	cout << m - n;
	
	return 0;
}