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

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

void main()
{
    auto N = readln.chomp.to!int;
    P[] as, bs;
    foreach (_; 0..N) {
        auto xy = readln.split.to!(int[]);
        as ~= P(xy[0], xy[1]);
    }
    foreach (_; 0..N) {
        auto xy = readln.split.to!(int[]);
        bs ~= P(xy[0], xy[1]);
    }
    sort!"a.x == b.x ? a.y > b.y : a.x > b.x"(as);
    sort!"a.x == b.x ? a.y > b.y : a.x > b.x"(bs);
    auto memo = new bool[](N);
    int r;
    foreach (a; as) {
        foreach (i, b; bs) {
            if (!memo[i] && a.x < b.x && a.y < b.y) {
                r++;
                memo[i] = true;
                break;
            }
        }
    }
    writeln(r);
}