#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

class flow {
public:
	struct edge {
		int to, rev; // 行先、逆辺
		ll cap; // 容量
		edge(int to, ll cap, int rev) :to(to), cap(cap), rev(rev) {}
	};
	vector<vector<edge>> path;
	vector<int> level, iter; // sからの距離、どこまで調べたか
	int numv; // 辺の本数
	flow(int n) {// n辺
		this->numv = 0;
		this->path.resize(n);
		this->level.resize(n);
		this->iter.resize(n);
	}
	void add_edge(int from, int to, ll cap) {
		this->path[from].push_back(edge(to, cap, this->path[to].size()));
		this->path[to].push_back(edge(from, 0, this->path[from].size() - 1)); // 逆辺
		this->numv++;
	}
	void dist(int s) {
		fill(this->level.begin(), this->level.end(), -1);
		this->bfs(s);
	}
	void bfs(int s) { // sからの最短距離計算
		queue<int> q;
		q.push(s);
		this->level[s] = 0;
		while (!q.empty()) {
			int p = q.front();
			q.pop();
			for (int i = 0; i < this->path[p].size(); ++i) {
				edge& e = this->path[p][i];
				if (e.cap > 0 && this->level[e.to] < 0) {
					this->level[e.to] = this->level[p] + 1;
					q.push(e.to);
				}
			}
		}
	}
	ll inc_path(int v, int t, ll f) { // 増加パスをDFSで探す
		fill(this->iter.begin(), this->iter.end(), 0);
		return dfs(v, t, f);
	}
	ll dfs(int v, int t, ll f) {
		if (v == t)return f;
		for (int& i = this->iter[v]; i < this->path[v].size(); ++i) {
			edge& e = this->path[v][i];
			if (e.cap > 0 && this->level[v] < this->level[e.to]) {
				ll d = this->dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					this->path[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	ll max_flow(int s, int t) { // sからtへの最大流を計算
		ll flow_value = 0;
		while (true) {
			this->dist(s);
			if (this->level[t] < 0)return flow_value;
			ll f;
			while ((f = this->inc_path(s, t, 10)) > 0) {
				flow_value += f;
			}
		}
	}
};


int main() {
	IOS;
	int x, y;
	int n, m;
	cin >> x >> y >> m;
	n = x + y;
	flow fl(n+2);
	vector<int> xv(m), yv(m);
	REP(i, m) {
		cin >> xv[i] >> yv[i];
		yv[i] += x;
		fl.add_edge(xv[i], yv[i], 1);
	}
	int st = n, te = n + 1;
	REP(i, x) {
		fl.add_edge(st, i, 1);
		
	}
	REP(i, y) {
		fl.add_edge(i+x, te, 1);
	}
	put(fl.max_flow(st, te));
	return 0;
}



Measured memory_bytes: 3324