#include <bits/stdc++.h>
using namespace std;

int match[1001], v;
bool vis[1001];
vector<int> graph[1001];

bool dfs(int x){
	vis[x] = true;
	for (int i = 0; i < graph[x].size(); ++i){
		int u = graph[x][i], w = match[u];
		if (w < 0 || !vis[w] && dfs(w)){
			match[x] = u;
			match[u] = x;
			return true;
		}
	}
	return false;
}

int bipmatch(){
	int res = 0;
	memset(match, -1, sizeof(match));
	for (int i = 0; i < v; ++i){
		//该点仍未匹配
		if (match[i] < 0){
			memset(vis, 0, sizeof(vis));
			if (dfs(i))++res;
		}
	}
	return res;
}

int main()
{
	int a, b, x, y, e;
	scanf("%d%d%d", &x, &y, &e);
	for (int i = 0; i < e; ++i){
		scanf("%d%d", &a, &b);
		graph[a].push_back(x + b);
		graph[x + b].push_back(a);
	}
	v = x + y;
	printf("%d\n", bipmatch());
	return 0;
}
