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

alias Point = Tuple!(int, "x", int, "y");

int N;
Point[100] RS, BS;
int[immutable(int)[]][immutable(int)[]] MEMO;

void main()
{
    N = readln.chomp.to!int;
    foreach (i; 0..N) {
        auto ab = readln.split.to!(int[]);
        RS[i] = Point(ab[0], ab[1]);
    }
    auto rs = RS[0..N];
    foreach (i; 0..N) {
        auto cd = readln.split.to!(int[]);
        BS[i] = Point(cd[0], cd[1]);
    }
    auto bs = BS[0..N];

    int solve(immutable(int)[] rs, immutable(int)[] bs) {
        if (rs.empty) return 0;
        if (bs in MEMO && rs in MEMO[bs]) return MEMO[bs][rs];
        int max_p;
        foreach (i, r; rs) {
            foreach (j, b; bs) {
                max_p = max(max_p, (RS[r].x < BS[b].x && RS[r].y < BS[b].y ? 1 : 0) + solve(rs[0..i] ~ rs[i+1..$], bs[0..j] ~ bs[j+1..$]));
            }
        }
        return MEMO[bs][rs] = max_p;
    }

    writeln(solve(0.iota(N).array, 0.iota(N).array));
}