import sys


def spam(ab, cd, count=0):
    ab = ab[:]
    cd = cd[:]
    for x in ab:
        for y in cd:
            if x[0] < y[0] and x[1] < y[1]:
                ab.remove(x)
                cd.remove(y)
                return spam(ab, cd, count + 1)
    return count


def main():
    N = int(sys.stdin.readline())
    ab = [[int(x) for x in sys.stdin.readline().split()] for _ in range(N)]
    cd = [[int(x) for x in sys.stdin.readline().split()] for _ in range(N)]
    ab1 = sorted(ab, key=lambda x: (x[0], x[1]))
    cd1 = sorted(cd, key=lambda x: (x[0], x[1]))
    ab2 = sorted(ab, key=lambda x: (x[1], x[0]))
    cd2 = sorted(cd, key=lambda x: (x[1], x[0]))
    print(max([spam(ab1, cd1), spam(ab2, cd2)]))


if __name__ == '__main__':
    main()
