import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math, core.stdc.stdio;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

struct Point {
    int x, y;
}

bool ismatch(Point a, Point b) {
    return a.x < b.x && a.y < b.y;
}

void main() {
    int n = readint();
    auto as = new Point[n];
    auto bs = new Point[n];
    foreach(ref p; as)
        readf("%d %d\n", &p.x, &p.y);
    foreach(ref p; bs)
        readf("%d %d\n", &p.x, &p.y);

    as.sort!("a.x < b.x");
    bs.sort!("a.x < b.x");

    bool[110] used;
    int ans;
    foreach(b; bs) { 
        int ymax = -1, id = -1;
        foreach_reverse(i, a; as) {
            if (ismatch(a, b) && !used[i] && ymax < a.y) {
                ymax = a.y;
                id = i.to!int;
            }
        }
        if (id != -1) {
            used[id] = true;
            ans++;
        }
    }
    ans.writeln;
    
    auto _ = readln(); // dbg
}