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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

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

int maxBipartiteMatching(bool[][] g) {

    bool mbm(int p, int[] left, int[] right, bool[][] g, bool[] used) {
        for (int i = 0; i < right.length; i++) {
            if (g[p][i] && right[i] == -1) {
                left[p] = i;
                right[i] = p;
                return true;
            }
        }

        for (int i = 0; i < right.length; i++) {
            if (g[p][i] && !used[i]) {
                used[i] = true;
                if (mbm(right[i], left, right, g, used)) {
                    left[p] = i;
                    right[i] = p;
                    return true;
                }
            }
        }
        return false;
    }

    auto left = new int[g.length];
    auto right = new int[g[0].length];
    left[] = -1;
    right[] = -1;
    int cnt = 0;
    for (int i = 0; i < left.length; i++) {
        auto used = new bool[left.length];
        if (mbm(i, left, right, g, used)) {
            cnt++;
        }
    }
    return cnt;
}

int calc(Point[] ab, Point[] cd) {
    assert(ab.length == cd.length);

    auto n = ab.length;
    auto g = new bool[][](n, n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (ab[i].x < cd[j].x && ab[i].y < cd[j].y) {
                g[i][j] = true;
            }
        }
    }
    return maxBipartiteMatching(g);
}

void main() {
    int n = readint;

    Point[] ab, cd;
    for (int i = 0; i < n; i++) {
        auto xy = readints;
        ab ~= Point(xy[0], xy[1]);
    }
    for (int i = 0; i < n; i++) {
        auto xy = readints;
        cd ~= Point(xy[0], xy[1]);
    }

    writeln(calc(ab, cd));
}
