#include<vector>
#include<iostream>

struct BipartiteMatching {
    int n;
    std::vector<std::vector<int>> G;
    std::vector<int> match;
    std::vector<bool> used;
    BipartiteMatching(int n) : n(n), G(n), match(n), used(n) {}
    void addEdge(int u, int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }
    bool dfs(int v) {
        used[v] = true;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i], w = match[u];
            if (w < 0 || !used[w] && dfs(w)) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
    std::vector<std::pair<int, int>> getMaxMatching() {
        std::vector<std::pair<int, int>> ret;
        fill(match.begin(), match.end(), -1);
        for (int i = 0; i < n; i++) {
            if (match[i] < 0) {
                fill(used.begin(), used.end(), false);
                dfs(i);
            }
        }
        for (int i = 0; i < n; i++) {
            if (i < match[i]) { ret.push_back({i, match[i]}); }
        }
        return ret;
    }
};

#include<bits/stdc++.h>
using namespace std;

int main() {
    int X, Y, E;
    cin >> X >> Y >> E;
    BipartiteMatching bm(X + Y);
    for (int i = 0; i < E; i++) {
        int x, y;
        cin >> x >> y;
        bm.addEdge(x, X + y);
    }
    cout << bm.getMaxMatching().size() << endl;
}
