n = int(input())

red = []
blue = []

for i in range(n):
    red.append(tuple(map(int, input().split())))
for i in range(n):
    blue.append(tuple(map(int, input().split())))

red.sort(key=lambda x:x[1])
red.reverse()

blue.sort(key=lambda x:x[0])

res = 0

for b in range(n):
    for r in range(len(red)):
        if blue[b][0] > red[r][0] and blue[b][1] > red[r][1]:
            res += 1
            del red[r]
            break

print(res)
