import copy
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])

red_list = copy.copy(red)
blue_list = copy.copy(blue)
    
red_list.sort()
blue_list.sort()
count = 0
for i in range(n):
    a, b = red_list.pop(0)
    for j in range(len(blue_list)):
        if (a < blue_list[j][0]) & (b < blue_list[j][1]):
            count += 1
            blue_list.pop(j)
            break

red_list = copy.copy(red)
blue_list = copy.copy(blue)
    
red_list.sort(key=lambda x: x[1])
blue_list.sort(key=lambda x: x[1])
count1 = 0
for i in range(n):
    a, b = red_list.pop(0)
    for j in range(len(blue_list)):
        if (a < blue_list[j][0]) & (b < blue_list[j][1]):
            count1 += 1
            blue_list.pop(j)
            break            

ans = max(count, count1)        
print(ans)