mod = 10 ** 9 + 7



N = int(eval(input()))

A = [(int(eval(input())), -1) for _ in range(N)]

B = [(int(eval(input())), 1) for _ in range(N)]



C = sorted(A + B)



res = 1

cnt = 0

for _, delta in C:

    if cnt != 0 and cnt * delta < 0:

        res *= abs(cnt)

        res %= mod

    cnt += delta



print(res)
mod = 10 ** 9 + 7



N = int(eval(input()))

A = [(int(eval(input())), 1) for _ in range(N)]

B = [(int(eval(input())), -1) for _ in range(N)]



C = sorted(A + B)



res = 1

cnt = 0

for _, delta in C:

    if cnt * delta < 0:

        res *= abs(cnt)

        res %= mod

    cnt += delta



print(res)
mod = 10**9 + 7
N = int(eval(input()))
A = [(int(eval(input())), -1) for _ in range(N)]
B = [(int(eval(input())), 1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
    if cnt != 0 and cnt * delta < 0:
        res *= abs(cnt)
        res %= mod
    cnt += delta
print(res)

mod = 10**9 + 7
N = int(eval(input()))
A = [(int(eval(input())), 1) for _ in range(N)]
B = [(int(eval(input())), -1) for _ in range(N)]
C = sorted(A + B)
res = 1
cnt = 0
for _, delta in C:
    if cnt * delta < 0:
        res *= abs(cnt)
        res %= mod
    cnt += delta
print(res)

-A = [(int(eval(input())), -1) for _ in range(N)] -B = [(int(eval(input())), 1) for _ in range(N)] +A = [(int(eval(input())), 1) for _ in range(N)] +B = [(int(eval(input())), -1) for _ in range(N)] -    if cnt != 0 and cnt * delta < 0: +    if cnt * delta < 0: