N = int(input())
a_b = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
a_b = sorted(a_b)
c_d = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
c_d = sorted(c_d)

ans = 0
for a, b in a_b:
    check = 0
    for i, cd in enumerate(c_d):
        if a < cd[0] and b < cd[1] and check==0:       
            c_d.remove(c_d[i])
            check += 1
            ans += 1
         
print(ans)