/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define Jehian using
#define Norman namespace
#define Saviero std
#define cepet {ios_base::sync_with_stdio(nullptr);cin.tie(nullptr);}

Jehian Norman Saviero;

/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n")
#define sp printf(" ")

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) for(ll _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y
#define SQR(x) (x)*(x)
#define CUBE(x) SQR(x)*(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLSIZE(x,n) (x), (x)+(n)

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

struct Edge{
	int v;
	int flow;
	int C;
	int rev;
};
 
class Graph{
    int V;
    int *level;
    vector< Edge > *adj;

	public :
		Graph(int V){
			adj = new vector<Edge>[V];
			this->V = V;
			level = new int[V];
		}
		void addEdge(int u, int v, int C){
			Edge a{v, 0, C, (int) adj[v].size()};
			Edge b{u, 0, 0, (int) adj[u].size()};
			adj[u].pb(a);
			adj[v].pb(b);
		}
		bool BFS(int s, int t);
		int sendFlow(int s, int flow, int t, int ptr[]);
		int DinicMaxflow(int s, int t);
};
 
bool Graph::BFS(int s, int t){
	for (int i = 0 ; i < V ; i++){
		level[i] = -1;
	}
	level[s] = 0;
	list< int > q;
	q.push_back(s);
	vector<Edge>::iterator i;
	while (!q.empty()){
		int u = q.front();
		q.pop_front();
		for (i = adj[u].begin(); i != adj[u].end(); i++){
			Edge &e = *i;
			if (level[e.v] < 0  && e.flow < e.C){
				level[e.v] = level[u] + 1;
				q.push_back(e.v);
			}
		}
	}
	return level[t] < 0 ? false : true ;
}
 
int Graph::sendFlow(int u, int flow, int t, int start[]){
	if (u == t){
		return flow;
	}
	for (; start[u] < adj[u].size(); start[u]++){
		Edge &e = adj[u][start[u]]; 

		if (level[e.v] == level[u]+1 && e.flow < e.C){
			int curr_flow = min(flow, e.C - e.flow);

			int temp_flow = sendFlow(e.v, curr_flow, t, start);

			if (temp_flow > 0){
				e.flow += temp_flow;
				adj[e.v][e.rev].flow -= temp_flow;
				return temp_flow;
			}
		}
	}

	return 0;
}
 
int Graph::DinicMaxflow(int s, int t){
	if (s == t){
		return -1;
	}

	int total = 0;

	while (BFS(s, t) == true){
		int *start = new int[V+1];
		while (int flow = sendFlow(s, INT_MAX, t, start)){
			total += flow;
		}
	}
	return total;
}

bool cmp(pll& a, pll& b){
	return a.se < b.se;
}

int main(){
	ll N;
	scll(N);
	vector< vector<pll> > data;
	for (ll i = 0; i < 2; ++i){
		vector<pll> tmp;
		pll dat;
		for (ll j = 0; j < N; ++j){
			scll(dat.fi);
			scll(dat.se);
			tmp.pb(dat);
		}
		data.pb(tmp);
	}

	ll nodes = 2*N+5;
	ll go[nodes];
	RESET(go);
	Graph g(nodes);
	for (ll i = 0; i < N; ++i){
		for (ll j = 0; j < N; ++j){
			if (data[0][i].fi < data[1][j].fi && data[0][i].se < data[1][j].se){
				++go[i+1];
				++go[N+j+1];
				g.addEdge(i+1, N+j+1, 1);
			}
		}
	}

	for (ll i = 1; i <= N; ++i){
		if (go[i]){
			g.addEdge(0, i, 1);
		}
	}

	for (ll i = 1; i <= N; ++i){
		if (go[N+i]){
			g.addEdge(N+i, nodes-1, 1);
		}
	}

	cout << g.DinicMaxflow(0, nodes-1) << endl;
	return 0;
}


Measured memory_bytes: 384