#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
//by NeighThorn
using namespace std;
const int maxn=200+5,maxm=10000+5;
int n,m,e,hd[maxn],to[maxm*2],nxt[maxm*2],cnt,pre[maxn],vis[maxn],ans;
inline void add(int x,int y){
	to[cnt]=y;nxt[cnt]=hd[x];hd[x]=cnt++;
}
inline bool dfs(int root){
	for(int i=hd[root];i!=-1;i=nxt[i])
		if(!vis[to[i]]){
			vis[to[i]]=1;
			if(pre[to[i]]==-1||dfs(pre[to[i]])){
				pre[to[i]]=root;
				return true;
			}
		}
	return false;
}
signed main(void){
	cnt=0;ans=0;
	memset(hd,-1,sizeof(hd));
	memset(pre,-1,sizeof(pre));
	scanf("%d%d%d",&n,&m,&e);
	for(int i=1,x,y;i<=e;i++)
		scanf("%d%d",&x,&y),add(x,y+n);
	for(int i=0;i<n;i++)
		memset(vis,0,sizeof(vis)),ans+=dfs(i);
	cout<<ans<<endl;
	return 0;
}