from operator import itemgetter





def main():

    N = int(eval(input()))

    ab = [tuple(int(j) for j in input().split()) for i in range(N)]

    cd = [tuple(int(j) for j in input().split()) for i in range(N)]

    # y 降順

    ab.sort(key=itemgetter(1), reverse=True)

    # x 昇順

    cd.sort(key=itemgetter(0))

    ans = 0

    for bx, by in cd:

        for rx, ry in ab:

            if rx < bx and ry < by:

                ab.remove((rx, ry))

                ans += 1

                break

    print(ans)

    return





main()

from operator import itemgetter





def main():

    N = int(eval(input()))

    ab = [tuple(int(j) for j in input().split()) for i in range(N)]

    cd = [tuple(int(j) for j in input().split()) for i in range(N)]

    # y 降順

    ab.sort(key=itemgetter(1), reverse=True)

    # x 昇順

    cd.sort()

    # ペアになった赤

    done = [False] * N

    for bx, by in cd:

        for k, ((rx, ry), d) in enumerate(zip(ab, done)):

            if not d and rx < bx and ry < by:

                done[k] = True

                break

    print((sum(done)))

    return





main()

from operator import itemgetter


def main():
    N = int(eval(input()))
    ab = [tuple(int(j) for j in input().split()) for i in range(N)]
    cd = [tuple(int(j) for j in input().split()) for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort(key=itemgetter(0))
    ans = 0
    for bx, by in cd:
        for rx, ry in ab:
            if rx < bx and ry < by:
                ab.remove((rx, ry))
                ans += 1
                break
    print(ans)
    return


main()

from operator import itemgetter


def main():
    N = int(eval(input()))
    ab = [tuple(int(j) for j in input().split()) for i in range(N)]
    cd = [tuple(int(j) for j in input().split()) for i in range(N)]
    # y 降順
    ab.sort(key=itemgetter(1), reverse=True)
    # x 昇順
    cd.sort()
    # ペアになった赤
    done = [False] * N
    for bx, by in cd:
        for k, ((rx, ry), d) in enumerate(zip(ab, done)):
            if not d and rx < bx and ry < by:
                done[k] = True
                break
    print((sum(done)))
    return


main()

-    cd.sort(key=itemgetter(0)) -    ans = 0 +    cd.sort() +    # ペアになった赤 +    done = [False] * N -        for rx, ry in ab: -            if rx < bx and ry < by: -                ab.remove((rx, ry)) -                ans += 1 +        for k, ((rx, ry), d) in enumerate(zip(ab, done)): +            if not d and rx < bx and ry < by: +                done[k] = True -    print(ans) +    print((sum(done)))