#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 2020000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    for(auto itr = a.begin(); itr != a.end(); itr++){
		cout << *itr << " ";
	}
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){
	cout << "debug: " << a << " " << b << "\n";
}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << "debug: " << a << " " << b << " " << c << "\n";
}
void mark() {cout << "#" << "\n";}
ll pcount(ll x) {return __builtin_popcountll(x);}
//const int mod = 1e9 + 7;
const int mod = 998244353;

struct Dinic{
	struct edge{
		ll to, cap, rev;
	};
	vector<vector<edge>> G;
	vector<int> level, itr;
	ll n;
	const ll INF = 1<<30;
 
	Dinic(ll n) : n(n){
		G.resize(n);
		level.resize(n);
		itr.resize(n);
	}
 
	void add_edge(ll from, ll to, ll cap){
		G[from].push_back({to,cap,(ll)G[to].size()});
		G[to].push_back({from,0,(ll)G[from].size()-1});
	}
 
	void bfs(int s){
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[s] = 0;
		q.push(s);
		while(!q.empty()){
			int u = q.front(); q.pop();
			for(auto &e : G[u]){
				if(e.cap > 0 && level[e.to] < 0){
					level[e.to] = level[u] + 1;
					q.push(e.to);
				}
			}
		}
	}

	ll dfs(int u, int t, ll f){
		if(u == t) return f;
		for(int &i = itr[u]; i < G[u].size(); i++){
			edge &e = G[u][i];
			if(e.cap > 0 && level[u] < level[e.to]){
				ll 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;
	}
 
	ll max_flow(ll s, ll t){
		ll flow = 0;
		while(1){
			bfs(s);
			if(level[t] < 0) return flow;
			fill(itr.begin(), itr.end(), 0);
			ll f;
			while((f = dfs(s, t, INF)) > 0){
				flow += f;
			}
		}
	}
};

int main(){
	int n; cin >> n;
	vl a(n),b(n),c(n),d(n);
	rep(i,n) cin >> a[i] >>  b[i];
	rep(i,n) cin >> c[i] >> d[i];
	Dinic g(2*n+2);
	int S = 2*n, T = 2*n+1;
	rep(i,n) g.add_edge(S,i,1);
	rep(j,n) g.add_edge(j+n,T,1);
	rep(i,n){
		rep(j,n){
			if(a[i] < c[j] && b[i] < d[j]){
				g.add_edge(i,j+n,1);
			}
		}
	}
	cout << g.max_flow(S,T) << "\n";
}

Measured memory_bytes: 3828