import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int solve (int n)
{
	auto x = new int [n * 2];
	auto y = new int [n * 2];
	foreach (i; 0..n * 2)
	{
		readf (" %s %s", &x[i], &y[i]);
	}
	auto a = new bool [] [] (n, n);
	foreach (i; 0..n)
	{
		foreach (j; 0..n)
		{
			a[i][j] = (x[i] < x[j + n]) && (y[i] < y[j + n]);
		}
	}
	auto b = new bool [n];
	auto c = new int [n];
	c[] = -1;

	bool bipart (int v)
	{
		if (b[v])
		{
			return false;
		}
		b[v] = true;
		foreach (u; 0..n)
		{
			if (a[v][u] && (c[u] == -1 || bipart (c[u])))
			{
				c[u] = v;
				return true;
			}
		}
		return false;
	}

	int res = 0;
	foreach (v; 0..n)
	{
		b[] = false;
		res += bipart (v);
	}
	return res;
}

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		writeln (solve (n));
	}
}
