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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

// dinic
int inf = INT32_MAX;
struct max_flow {
	struct edge { int to, cap, rev; }; // 行き先，容量，逆辺
	int V;
	vector<vector<edge>> G;
	vector<int> itr, level;

	max_flow(int V) : V(V) { G.assign(V,vector<edge>()); }

	void add_edge(int from, int to, int cap) {
		G[from].push_back((edge) {to, cap, (int) G[to].size()});
		G[to].push_back((edge) {from, 0, (int) G[from].size()-1});
	}

	void bfs(int s) {
		level.assign(V,-1);
		queue<int> q;
		level[s] = 0; q.push(s);
		while (!q.empty()) {
			int v = q.front(); q.pop();
			for(auto &e: G[v]){
				if (e.cap > 0 and level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.push(e.to);
				}
			}
		}
	}

	int dfs(int v, int t, int f) {
		if (v == t) return f;
		for (int& i = itr[v]; i < (int) G[v].size(); ++i) {
			edge& e = G[v][i];
			if (e.cap > 0 and level[v] < level[e.to]) {
				int d = dfs(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	int run(int s, int t) {
		int ret = 0, f;
		while (bfs(s), level[t] >= 0) {
			itr.assign(V,0);
			while ((f = dfs(s, t, inf)) > 0) ret += f;
		}
		return ret;
	}
};

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	vector<PLL> red(n), blue(n);
	for (int i = 0; i < n; i++) {
		int x,y;
		cin >> x >> y;
		red[i] = make_pair(x,y);
	}
	for (int i = 0; i < n; i++) {
		int x,y;
		cin >> x >> y;
		blue[i] = make_pair(x,y);
	}
	struct max_flow g(2*n + 2); // s:0, red:1-n, blue:n+1-2n, t:2n+1
	for (int i = 0; i < n; i++) { // s -> redへの辺を張る
		g.add_edge(0, i+1, 1);
	}
	for (int i = 0; i < n; i++) { // blue -> tへの辺を張る
		g.add_edge(n+i+1, 2*n+1, 1);
	}
	for (int i = 0; i < n; i++) {// red -> blueへの辺を張る
		for (int j = 0; j < n; j++) {
			if (red[i].first < blue[j].first and red[i].second < blue[j].second) {
				g.add_edge(i+1, n+j+1, 1);
			}
		}
	}
	cout << g.run(0, n*2+1) << endl;
	return 0;
}


Measured memory_bytes: 384