#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b))
struct node {
  int id;
  int cap;
  struct node *next;
};
struct node **list;
int **flow, *visit;
void Insert(int, int);
int Maxflow(int, int, int, int);
int main(void)
{
  int i, x, y, v, e, s, t, maxflow = 0;
  scanf("%d %d %d", &x, &y, &e);
  v = x + y + 2;
  list = (struct node**)malloc(sizeof(struct node*) * v);
  flow = (int**)malloc(sizeof(int*) * v);
  visit = (int*)malloc(sizeof(int) * v);
  for (i = 0; i < v; i++) {
    list[i] = NULL;
    flow[i] = (int*)calloc(v, sizeof(int));
  }
  for (i = 0; i < e; i++) {
    scanf("%d %d", &s, &t);
    Insert(0, s + 1);
    Insert(x + t + 1, v - 1);
    Insert(s + 1, x + t + 1);
  }
  while (1) {
    int f;
    for (i = 0; i < v; i++) visit[i] = 0;
    f = Maxflow(0, v - 1, v, INT_MAX);
    if (!f) break;
    maxflow += f;
  }
  printf("%d\n", maxflow);
  for (i = 0; i < v; i++) {
    free(list[i]);
    free(flow[i]);
  }
  free(list);
  free(flow);
  free(visit);
}
void Insert(int a, int b)
{
  struct node *p = (struct node*)malloc(sizeof(struct node));
  p->id = b;
  p->cap = 1;
  p->next = list[a];
  list[a] = p;
  p = (struct node*)malloc(sizeof(struct node));
  p->id = a;
  p->cap = 0;
  p->next = list[b];
  list[b] = p;
}
int Maxflow(int s, int t, int size, int f)
{
  struct node *n;
  visit[s] = 1;
  if (s == t) return f;
  for (n = list[s]; n != NULL; n = n->next) {
    int v = n->id;
    if (!visit[v] && flow[s][v] < n->cap) {
      int d = Maxflow(v, size - 1, size, MIN(f, n->cap - flow[s][v]));
      if (d > 0) {
        flow[s][v] += d;
        flow[v][s] -= d;
        return d;
      }
    }
  }
  return 0;
}
