#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <complex>
#include <regex>
#include <random>
using namespace std;

#define rep(i,n)	for(lint i = 0; i < n; i++)
#define repr(i,n)	for(lint i = n - 1; i >= 0; i--)
#define repi(i,ini,n)	for(lint i = ini; i < n; i++)
#define repir(i,ini,n)	for(lint i = n-1; i >= ini; i--)
#define repb(i,start,end)	for(lint i = start; i <= end; i++)
#define repbr(i,start,end)	for(lint i = end; i >= start; i--)

#define bit(n)				(1LL << (n))

#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rg(v, ini, end) v.begin() + ini, v.begin()+end

#define ret return 0;
#define chmax(a, b) a=max(a,b)
#define chmin(a, b) a=min(a,b)

using lint = long long;
using ulint = unsigned long long;
using ld = long double;
struct xy
{
	lint x, y;
	xy() :x(0), y(0) {}
	xy(lint _x, lint _y) : x(_x), y(_y) {}
	xy operator+(const xy& p) const
	{
		return xy(x + p.x, y + p.y);
	}
	bool operator<(xy p) const
	{
		if (y == p.y)
			return x < p.x;
		return y < p.y;
	}
};
struct xyd
{
	ld x, y;
	xyd() :x(0), y(0) {}
	xyd(long double _x, long double _y) : x(_x), y(_y) {}
};
using vec = vector<lint>;
using vecd = vector<ld>;
using vecs = vector<string>;
using vecp = vector<xy>;
template<class T> using vect = vector<T>;
class vec2 : public vector<vector<lint>>
{
public:
	vec2() {}
	vec2(lint n) : vector(n) {}
	vec2(lint h, lint w) : vector(h, vector<lint>(w)) {}
	vec2(lint h, lint w, lint v) : vector(h, vector<lint>(w, v)) {}
};

template<class T> using priq = priority_queue<T>;
template<class T> using rpriq = priority_queue<T, vector<T>, greater<T>>;
template<class Key, class Val> using hashmap = unordered_map<Key, Val>;
template<class Key> using hashset = unordered_set<Key>;

template<class It>
constexpr typename It::value_type rmax(It begin, It end) {
	return *max_element(begin, end);
}

template<class T1, class T2>
constexpr auto mmax(T1 arg1, T2 arg2) {
	using T = decltype(arg1 + arg2);
	return max(T(arg1), T(arg2));
}

template<class T, class ...Types>
constexpr auto mmax(T arg0, Types ...args) {
	return mmax(arg0, mmax(args...));
}

template<class It>
constexpr typename It::value_type rmin(It begin, It end) {
	return *min_element(begin, end);
}

template<class T1, class T2>
constexpr auto mmin(T1 arg1, T2 arg2) {
	using T = decltype(arg1 + arg2);
	return min(T(arg1), T(arg2));
}

template<class T, class ...Types>
constexpr auto mmin(T arg0, Types ...args) {
	return mmin(arg0, mmin(args...));
}

mt19937 mtrand((random_device())());

const double pi = 3.141592653589793238462;
const lint intmax = 9223372036854775807;
const lint inf = 1100100100100100100LL;

constexpr lint div2(lint p, lint q)
{
	return (p + q - 1) / q;
}

#if(__cplusplus < 201703L)

lint gcd(lint a, lint b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

lint lcm(lint a, lint b)
{
	return a / gcd(a, b) * b;
}

#endif

template<class T>
struct nval {
	lint n;		// counts
	T val;
	nval() : n(0) {};
	nval(lint _n, T _val) : n(_n), val(_val) {};
};

template<class It, class It2>
auto spacel(It i, It2 end)
{
	if (i + 1 == end)
	{
		return '\n';
	}
	else
	{
		return ' ';
	}
}

ostream& setp(ostream& ost)
{
	cout << setprecision(60) << fixed;
	return ost;
}

const ulint mod = 1000000007;
//const ulint mod = 998244353;
const ld eps = 0.0000001;

struct graph
{
	struct R
	{
		lint to, cap, re;
	};

	lint v, e;

	vector<vector<R>> gr;

	graph(lint _v) : v(_v), e(0), gr(v)
	{}

	void add_e(lint from, lint to, lint cap)
	{
		lint re = gr[to].size(), rre = gr[from].size();

		gr[from].push_back({ to, cap, re });
		gr[to].push_back({ from, 0, rre });
		e++;
	}

	auto bfs(lint s)
	{
		vector<lint> d(v, intmax);
		d[s] = 0;

		queue<lint> q;

		q.push(s);
		while (!q.empty())
		{
			lint next = q.front();
			q.pop();
			rep(i, gr[next].size())
			{
				if (gr[next][i].cap > 0 && d[next] + 1 < d[gr[next][i].to])
				{
					d[gr[next][i].to] = d[next] + 1;
					q.push(gr[next][i].to);
				}
			}
		}

		return d;
	}

	lint dfs(vector<lint>& it, vector<lint>& d, lint s, lint t, lint neck = intmax)
	{
		if (s == t)
			return neck;
		repi(i, it[s], gr[s].size())
		{
			if (d[s] < d[gr[s][i].to] && gr[s][i].cap > 0)
			{
				lint neck2 = mmin(
					neck,
					dfs(it, d, gr[s][i].to, t, mmin(neck, gr[s][i].cap)));
				if (neck2 > 0)
				{
					gr[s][i].cap -= neck2;
					gr[gr[s][i].to][gr[s][i].re].cap += neck2;
					return neck2;
				}
			}
		}

		return 0;
	}

	auto dinic(lint s, lint t)
	{
		lint flow = 0;

		vec lev;

		while (lev = bfs(s), lev[t] != intmax)
		{
			vec it(v, 0);
			lint f;
			while ((f = dfs(it, lev, s, t)) > 0)
			{
				flow += f;
			}
		}

		return flow;
	}
};

lint a[110], b[110];

int main()
{
	lint n;
	cin >> n;

	graph g(2 * n + 2);
	lint s = 2*n, t = 2*n + 1;

	rep(i, n)
	{
		cin >> a[i] >> b[i];
		g.add_e(s, i, 1);
	}
	rep(i, n)
	{
		lint c, d;
		cin >> c >> d;
		rep(j, n)
		{
			if (a[j] < c && b[j] < d)
			{
				g.add_e(j, n + i, 1);
			}
		}
		g.add_e(n+i, t, 1);
	}

	auto ans = g.dinic(s, t);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3384