#include<iostream> usingnamespace std; int e[500][500], n, m, match[500], ans, book[500], cow[500]; intdfs(int u){ for (int i = 1; i <= m; i++){ if (e[u][i] == 1 && book[i] == 0){ book[i] = 1; if (match[i] == 0 || dfs(match[i]) == 1){ match[i] = u; return1; } } } return0; } intmain(){ int t, x, p; cin >> n >> m >> p; for (int i = 1; i <= p; i++){ cin >> t >> x; e[t][x] = 1; } for (int i = 1; i <= n; i++){ memset(book, 0, sizeof(book)); if (dfs(i) == 1) ans ++; } cout << ans << endl; return0; }