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

typedef pair<int, int> P;
int N;
vector<P> red, blue;
int ans = 0;

int main() {
	cin >> N;
	for (int i = 0; i < 2*N; i++) {
		int x, y;
		cin >> x >> y;
		if (i < N) {
			red.push_back(P(x, y));
		}
		else {
			blue.push_back(P(x, y));
		}
	}

	sort(red.begin(), red.end());
	for (int i = N - 1; i >= 0; i--) {
		int rx = red[i].first, ry = red[i].second;
		int min_by = 200, buf = -1;
		for (int j = 0; j < (int) blue.size(); j++) {
			int bx = blue[j].first, by = blue[j].second;
			if (bx > rx && by > ry && min_by > by) {
				min_by = by;
				buf = j;
			}
		}

		if (buf != -1) {
			blue.erase(blue.begin() + buf);
			ans++;
		}
	}

	cout << ans << endl;
}