from itertools import permutations

if __name__ == '__main__':
    N = int(input())
    RED = []
    BLUE = []

    for _ in range(N):
        a, b = map(int, input().split())
        RED.append((a, b))

    for _ in range(N):
        c, d = map(int, input().split())
        BLUE.append((c, d))

    AB = list(range(N))
    CD = list(range(N))
    ans = 0
    for ab in permutations(AB):
        for cd in permutations(CD):
            size = 0
            for i in range(N):
                red = RED[ab[i]]
                blue = BLUE[cd[i]]
                if red[0] < blue[0] and red[1] < blue[1]:
                    size += 1
            ans = max(ans, size)
    print(ans)
