#include <stdio.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)

//sからtへの最大流 O(E flow)を横着してO(VV flow)
//*
#define VMAX 210
int vcnt;
int foodoflag[VMAX];
int resflow[VMAX][VMAX];

int foododfs(int s,int t){
	if(s==t)return 1;
	foodoflag[s]=1;
	rep(i,0,vcnt)if(!foodoflag[i]&&resflow[s][i]>0){
		if(foododfs(i,t)){
			resflow[s][i]--;
			resflow[i][s]++;
			return 1;
		}
	}
	return 0;
}
int foodo(int s,int t){
	int ans=0;
	while(foododfs(s,t)){
		ans++;
		rep(i,0,vcnt)foodoflag[i]=0;
	}
	return ans;
}
#undef VMAX
//*/
int main(){
	int x,y,e;
	scanf("%d%d%d",&x,&y,&e);
	vcnt=x+y+2;
	while(e--){
		int p,q;
		scanf("%d%d",&p,&q);
		resflow[0][p+1]=1;
		resflow[p+1][q+x+1]=1;
		resflow[q+x+1][x+y+1]=1;
	}
	printf("%d\n",foodo(0,x+y+1));
}
