#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
#define F first
#define S second
signed main() {
	int n, ans = 0; cin >> n;
	pair<int, int>r[110], b[110];
	bool r_[110];

	for (int i = 0; i < n; i++)cin >> r[i].F >> r[i].S; sort(r, r + n);
	for (int i = 0; i < n; i++)cin >> b[i].F >> b[i].S; sort(b, b + n);
	for (int i = 0; i < n; i++)r_[i] = 0;

	for (int i = 0; i < n; i++) {
		int k = -1, j = 0;
		for (int j = 0; j < n&&r[j].F < b[i].F; j++) {
			if (!r_[j] && r[j].S < b[i].S) {
				if (k < 0)k = j;
				else {
					if (r[k].S < r[j].S)k = j;
				}
			}
		}
		if (k >= 0) {
			r_[k] = 1; ans++;
		}
	}
	cout << ans << endl;
}