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)
from heapq import heappush, heappop



mod = 10 ** 9 + 7



N, *E = list(map(int, open(0).read().split()))

Q = []

for i, e in enumerate(E):

    heappush(Q, (e, 1 if i < N else -1))



res = 1

cnt = 0

while Q:

    _, delta = heappop(Q)

    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 * delta < 0:
        res *= abs(cnt)
        res %= mod
    cnt += delta
print(res)

from heapq import heappush, heappop

mod = 10**9 + 7
N, *E = list(map(int, open(0).read().split()))
Q = []
for i, e in enumerate(E):
    heappush(Q, (e, 1 if i < N else -1))
res = 1
cnt = 0
while Q:
    _, delta = heappop(Q)
    if cnt * delta < 0:
        res *= abs(cnt)
        res %= mod
    cnt += delta
print(res)

+from heapq import heappush, heappop + -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) +N, *E = list(map(int, open(0).read().split())) +Q = [] +for i, e in enumerate(E): +    heappush(Q, (e, 1 if i < N else -1)) -for _, delta in C: +while Q: +    _, delta = heappop(Q)