if __name__ == "__main__":
    N = int(input())
    A = []
    B = []
    C = []
    D = []
    for i in range(N):
        buf1, buf2 = list(map(int, (input().split(' '))))
        A.append(buf1)
        B.append(buf2)
    for i in range(N):
        buf1, buf2 = list(map(int, (input().split(' '))))
        C.append(buf1)
        D.append(buf2)

    def calc_dist(a, b, c, d):
        return pow((pow((c - a), 2) + pow((d - b), 2)), 0.5)

    A_dist = {}
    B_dist = {}
    for i in range(N):
        a_key = str(A[i]) + '_' + str(B[i])
        b_key = str(C[i]) + '_' + str(D[i])
        A_dist[a_key] = calc_dist(0, 0, A[i], B[i])
        B_dist[b_key] = calc_dist(0, 0, C[i], D[i])
    A_dist = sorted(A_dist.items(), key=lambda x: x[1], reverse=True)
    B_dist = sorted(B_dist.items(), key=lambda x: x[1], reverse=True)
#    print(A_dist)
#    print(B_dist)
    A = []
    B = []
    C = []
    D = []
    for key,ele in A_dist:
        A.append(key.split('_')[0])
        B.append(key.split('_')[1])
    for key,ele in B_dist:
        C.append(key.split('_')[0])
        D.append(key.split('_')[1])
    ans1 = 0
    for i in range(N):
        for j in range(N):
            if len(A) <= i or len(C) <= j:
                break
            if (A[i] <= C[j]) and (B[i] <= D[j]):
#                print(A[i], B[i], C[j], D[j])
                ans1 += 1
                del C[j], D[j]
                break

    A_dist = sorted(A_dist.items(), key=lambda x: x[1])
    B_dist = sorted(B_dist.items(), key=lambda x: x[1])
#    print(A_dist)
#    print(B_dist)
    A = []
    B = []
    C = []
    D = []
    for key,ele in A_dist:
        A.append(key.split('_')[0])
        B.append(key.split('_')[1])
    for key,ele in B_dist:
        C.append(key.split('_')[0])
        D.append(key.split('_')[1])
    ans2 = 0
    for i in range(N):
        for j in range(N):
            if len(A) <= i or len(C) <= j:
                break
            if (A[i] <= C[j]) and (B[i] <= D[j]):
#                print(A[i], B[i], C[j], D[j])
                ans2 += 1
                del C[j], D[j]
                break
    if ans1 > ans2:
        print(ans1)
    else:
        print(ans2)


### FIXED CODE ###

if __name__ == "__main__":
#    N = int(input())
#    A = []
#    B = []
#    C = []
#    D = []
#    for i in range(N):
#        buf1, buf2 = list(map(int, (input().split(' '))))
#        A.append(buf1)
#        B.append(buf2)
#    for i in range(N):
#        buf1, buf2 = list(map(int, (input().split(' '))))
#        C.append(buf1)
#        D.append(buf2)
#
#    def calc_dist(a, b, c, d):
#        return pow((pow((c - a), 2) + pow((d - b), 2)), 0.5)
#
#    A_dist_buf = {}
#    B_dist_buf = {}
#    for i in range(N):
#        a_key = str(A[i]) + '_' + str(B[i])
#        b_key = str(C[i]) + '_' + str(D[i])
#        A_dist_buf[a_key] = calc_dist(0, 0, A[i], B[i])
#        B_dist_buf[b_key] = calc_dist(0, 0, C[i], D[i])
#    A_dist = sorted(A_dist_buf.items(), key=lambda x: x[1], reverse=True)
#    B_dist = sorted(B_dist_buf.items(), key=lambda x: x[1], reverse=True)
##    print(A_dist)
##    print(B_dist)
#    A = []
#    B = []
#    C = []
#    D = []
#    for key,ele in A_dist:
#        A.append(key.split('_')[0])
#        B.append(key.split('_')[1])
#    for key,ele in B_dist:
#        C.append(key.split('_')[0])
#        D.append(key.split('_')[1])
#    ans1 = 0
#    for i in range(N):
#        for j in range(N):
#            if len(A) <= i or len(C) <= j:
#                break
#            if ((A[i] < C[j]) and (B[i] < D[j])):
##                print(A[i], B[i], C[j], D[j])
#                ans1 += 1
#                del C[j], D[j]
#                break
#    print(ans1)

    N = int(input())
    R = [list(map(int, input().split(" "))) for _ in range(N)]
    B = [list(map(int, input().split(" "))) for _ in range(N)]
    R.sort(key=lambda x: (x[1], x[0]), reverse=True)
    B.sort(key=lambda x: (x[0], x[1]))
    f = [0] * N

    pair = 0
    for b in B:
        for i, r in enumerate(R):
            if r[0] < b[0] and r[1] < b[1] and f[i] == 0:
                pair += 1
                f[i] = 1
                break

    print(pair)