#include <cstdio> #include <iostream> #include <algorithm> #include <vector> #include <cstring> using namespace std; const int N=1010; int n,m,link[N],e; bool vis[N]; vector<int> G[N]; bool can(int u){ for(int i=0;i<G[u].size();i++){ int v=G[u][i]; if(!vis[v]){ vis[v]=1; if(link[v]==-1 || can(link[v])){ link[v]=u; return 1; } } } return 0; } int main(){ scanf("%d%d%d",&n,&m,&e); while(e--){ int u,v; scanf("%d%d",&u,&v); if(v<=m && u<=n)G[u].push_back(v); } int sum=0; memset(link,0xff,sizeof(link)); for(int i=1;i<=n;i++){ memset(vis,0,sizeof(vis)); if(can(i))sum++; } printf("%d ",sum); return 0; }