N = int(input())
r = []
b = []
for i in range(N):
    r.append([int(i) for i in input().split()])

for i in range(N):
    b.append([int(i) for i in input().split()])

sorted_r = sorted(r, key=lambda r:r[0], reverse=True)
sorted_b = sorted(b)

ans = 0
for e1 in sorted_b:
    for e2 in sorted_r:
        if e2[0] < e1[0] and e2[1] < e1[1]:
            ans += 1
            sorted_r.remove(e2)
            break
print(ans)
