#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#include<assert.h>

#define MAX_V 201
#define MAX_E 10001
#define TRUE 1
#define FALSE 0
#define UNUSED -1

int N, K, E; // E : the number of edges
int graph[MAX_V][MAX_E], size[MAX_V], match[MAX_V], used[MAX_V];

void add_edge(int s,int t) {
  graph[s][size[s]++] = t;
  graph[t][size[t]++] = s;
}

int dfs(int cur) {
  used[cur] = TRUE;
  int i, next, state;
  for(i=0;i<size[cur];++i) {
    next = graph[cur][i], state = match[next];
    if( state == UNUSED || ( !used[state] && dfs(state) ) ) {
      match[cur] = next;
      match[next] = cur;
      return TRUE;
    }
  }
  return FALSE;
}

int bmatch() {
  memset(match,UNUSED,sizeof match);
  int i, answer = 0;
  for(i=0;i<N;++i) {
    if( match[i] == UNUSED ) {
      memset(used, FALSE, sizeof used);
      if( dfs(i) ) {
	++answer;
      }
    }
  }
  return answer;
}

int main() {
  int i,s,t;
  scanf("%d %d %d",&N,&K,&E);
  assert( N+K < MAX_V);
  assert( E < MAX_E );
  for(i=0;i<E;i++) {
    scanf("%d %d",&s,&t);
    assert( 0 <= s && s < N );
    assert( 0 <= t && t < K );
    add_edge(s,N+t);
  }
  int maxi = bmatch();
  //printf("answer = %d\n",maxi);
  printf("%d\n",maxi);
  return 0;
}