#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

// Dinic
template<typename T>
struct Dinic {

    struct Graph {
        int to, rev;
        T cap;

        Graph(int t, int r, const T &c) : to(t), rev(r), cap(c) {};
    };

    vector<vector<Graph>> g;
    vector<int> level;
    vector<int> iter;
    int sz;

    Dinic(int N) : sz(N) {
        g.resize(N);
        iter.resize(N);
        level.resize(N);
    }

    void add_edge(int from, int to, T cap) {
        g[from].eb(to, (int) g[to].size(), cap);
        g[to].eb(from, (int) g[from].size() - 1, 0);
    }

    T operator()(int start, int end) {
        T flow = 0;
        while(true) {
            bfs(start);
            if (level[end] < 0) break;

            iter.assign(sz, 0);

            T f;
            while(f = dfs(start, end, inf) > 0) {
                flow += f;
            }
        }
        return flow;
    }

private:
    void bfs(int s) {
        level.assign(sz, -1);

        level[s] = 0;
        queue<int> q;
        q.push(s);

        while(!q.empty()) {
            int v = q.front(); q.pop();
            for(auto &e: g[v]) {
                int t = e.to;
                if (e.cap > 0 && level[t] < 0) {
                    level[t] = level[v] + 1;
                    q.push(t);
                }
            }

        }
    }

    T dfs(int v, int t, T flow) {
        if (v == t || flow == 0) return flow;

        for (int &i = iter[v]; i < g[v].size(); ++i) {
            auto &e = g[v][i];
            if(e.cap <= 0 || level[v] >= level[e.to]) continue;
            if (T f = dfs(e.to, t, min(flow, e.cap)) > 0) {
                e.cap -= f;
                g[e.to][e.rev].cap += f;
                return f;
            }
        }

        return 0;
    }
};

// Ford-Fulkerson
template<typename T>
struct FordFulkerson {

    struct Graph {
        int to, rev;
        T cap;

        Graph(int t, int r, const T &c) : to(t), rev(r), cap(c) {};
    };

    vector<vector<Graph>> g;
    vector<bool> used;
    int sz;

    FordFulkerson(int N) : sz(N) {
        g.resize(N);
        used.resize(N);
    }

    void add_edge(int from, int to, T cap) {
        g[from].eb(to, (int) g[to].size(), cap);
        g[to].eb(from, (int) g[from].size() - 1, 0);
    }

    T operator()(int start, int end) {
        T flow = 0;
        while (true) {
            used.assign(sz, false);
            int f = dfs(start, end, inf);
            if (f == 0) break;
            flow += f;
        }
        return flow;
    }

private:
    T dfs(int v, int t, T flow) {
        if (v == t) return flow;
        if (used[v] || flow == 0) return 0;
        used[v] = true;

        for (auto &e: g[v]) {
            if (used[e.to] || e.cap == 0) continue;

            if (T f = dfs(e.to, t, min(flow, e.cap)) > 0) {
                e.cap -= f;
                g[e.to][e.rev].cap += f;
                return f;
            }
        }

        return 0;
    }
};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_7_A&lang=jp#
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int X, Y, E;
    cin >> X >> Y >> E;

    Dinic<int> dnc(X + Y + 2);

    REP(i, E) {
        int x, y;
        cin >> x >> y;
        dnc.add_edge(x, X+y, 1);
    }

    REP(x, X) {
        dnc.add_edge(X+Y, x, 1);
    }

    REP(y, Y) {
        dnc.add_edge(X+y, X+Y+1, 1);
    }

    print(dnc(X+Y, X+Y+1));
}


Measured memory_bytes: 3316