#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<pair<pair<int,int>,char>> P(2*N);
	
	for(int i=0;i<2*N;i++){
		int x,y;
		cin>>x>>y;
		P[i].first = make_pair(x,y);
		if(i<N)P[i].second = 'R';
		else P[i].second = 'B';
	}
	
	sort(P.begin(),P.end());
	
	int ans = 0;
	set<int> y;
	
	for(int i=0;i<2*N;i++){
		if(P[i].second=='R')y.insert(P[i].first.second);
		else{
			auto it = y.lower_bound(P[i].first.second);
			if(it==y.begin())continue;
			it--;
			y.erase(it);
			ans++;
		}
	}
	
	cout<<ans<<endl;
	

		
    return 0;
}
