#include<stdio.h>
#include<string.h>
#define NMAX 100
#define KMAX 25
int matrix[NMAX*2][NMAX], match[NMAX], visit[NMAX];
int Dfs(int, int);
int main(void)
{
  int i, x, y, e, s, t, maxflow = 0;
  scanf("%d %d %d", &x, &y, &e);
  for (i = 0; i < y; i++) match[i] = -1;
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    matrix[s][t] = 1;
  }
  for (i = 0; i < x; i++) {
    memset(visit, 0, sizeof(int) * x);
    if (Dfs(i, y)) maxflow++;
  }
  printf("%d\n", maxflow);
}

int Dfs(int v, int ysize)
{
  int i;
  visit[v] = 1;
  for (i = 0; i < ysize; i++) {
    int w = match[i];
    if (!matrix[v][i]) continue;
    if (w < 0 || !visit[w] && Dfs(w, ysize)) {
      match[i] = v;
      return 1;
    }
  }
  return 0;
}
