#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};

template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}

extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

struct Edge
{
	int from,to,cost,rev;
};
class FlowNetwork
{
    public:
        FlowNetwork(int n):graph(vector<vector<Edge>>(n)),used(vector<char>(n))
        {}
        void add_Edge(int from, int to, int cap);
        int ford_fulkerson(int from, int to);

    private:
        vector<vector<Edge>> graph;
        vector<char> used;
        int dfs(int from, int to, int cap);
};
void FlowNetwork::add_Edge(int from, int to, int cap)
{
	graph[from].push_back((Edge){from,to,cap,(int)graph[to].size()});
	graph[to].push_back((Edge){to,from,0,(int)graph[from].size()-1});
}
int FlowNetwork::dfs(int from, int to, int f)
{
	if(from == to) return f;
	int d;
	used[from]=true;
	for(int i=0;i<graph[from].size();i++)
	{
		Edge &e=graph[from][i];
		if(used[e.to] || e.cost<=0) continue;
		d = dfs(e.to, to, min(e.cost, f));
		if(d>0)
		{
			e.cost -= d;
			graph[e.to][e.rev].cost += d;
			return d;
		}
	}
	return 0;
}
int FlowNetwork::ford_fulkerson(int from, int to)
{
	int flow=0;
	while(1)
	{
        fill(used.begin(),used.end(),0);
		int f=dfs(from,to,INF);
		if(f==0)break;
		flow += f;
	}
	return flow;
}



int main()
{
	int n;
	cin>>n;
	vector<PII> r(n),b(n);
	REP(i,n)
	{
		int a,b;
		cin>>a>>b;
		r[i]=PII(a,b);
	}
	REP(i,n)
	{
		int c,d;
		cin>>c>>d;
		b[i]=PII(c,d);
	}

	FlowNetwork flow(n*2+2);
	REP(i,n)
	REP(j,n)
	{
		if(r[i].first < b[j].first &&r[i].second < b[j].second )
		flow.add_Edge(i,j+n,1);
	}
	REP(i,n)
	{
		flow.add_Edge(n*2,i,1);
		flow.add_Edge(i+n,n*2+1,1);
	}
	print(flow.ford_fulkerson(n*2,n*2+1));
}


Measured memory_bytes: 384