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



mod = 10 ** 9 + 7



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

E = sorted((e, 1 if i < N else -1) for i, e in enumerate(E))



res = 1

cnt = 0

for _, delta in E:

    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

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

-Q = [] -for i, e in enumerate(E): -    heappush(Q, (e, 1 if i < N else -1)) +E = sorted((e, 1 if i < N else -1) for i, e in enumerate(E)) -while Q: -    _, delta = heappop(Q) +for _, delta in E: