from collections import defaultdict,deque

import sys,heapq,bisect,math,itertools,string,queue,datetime

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9+7

eps = 10**-7

def inpl(): return list(map(int, input().split()))

def inpls(): return list(input().split())



N = int(eval(input()))

points = []

for i in range(N):

    a = int(eval(input()))

    points.append([a,True])

for i in range(N):

    b = int(eval(input()))

    points.append([b,False])

points.sort()



ans = 1

an = bn = 0

for x,c in points:

    if c:

        if bn > 0:

            ans = (ans*bn)%mod

            bn -= 1

        else:

            an += 1

    else:

        if an > 0:

            ans = (ans*an)%mod

            an -= 1

        else:

            bn += 1



print((ans%mod))

from collections import defaultdict,deque

import sys,heapq,bisect,math,itertools,string,queue,copy,time

sys.setrecursionlimit(10**8)

INF = float('inf')

mod = 10**9+7

eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())



N = inp()

ab = []



for i in range(N):

    a = inp()

    ab.append([a,1])



for i in range(N):

    b = inp()

    ab.append([b,-1])



ab.sort()

cnt = 0

ans = 1

for x,k in ab:

    cnt += k

    if (cnt > 0) and (k > 0):

        ans *= cnt

    elif (cnt < 0) and (k < 0):

        ans *= -cnt

    ans %= mod

    

print((ans%mod))

from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7


def inpl():
    return list(map(int, input().split()))


def inpls():
    return list(input().split())


N = int(eval(input()))
points = []
for i in range(N):
    a = int(eval(input()))
    points.append([a, True])
for i in range(N):
    b = int(eval(input()))
    points.append([b, False])
points.sort()
ans = 1
an = bn = 0
for x, c in points:
    if c:
        if bn > 0:
            ans = (ans * bn) % mod
            bn -= 1
        else:
            an += 1
    else:
        if an > 0:
            ans = (ans * an) % mod
            an -= 1
        else:
            bn += 1
print((ans % mod))

from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time

sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpl_str():
    return list(sys.stdin.readline().split())


N = inp()
ab = []
for i in range(N):
    a = inp()
    ab.append([a, 1])
for i in range(N):
    b = inp()
    ab.append([b, -1])
ab.sort()
cnt = 0
ans = 1
for x, k in ab:
    cnt += k
    if (cnt > 0) and (k > 0):
        ans *= cnt
    elif (cnt < 0) and (k < 0):
        ans *= -cnt
    ans %= mod
print((ans % mod))

-import sys, heapq, bisect, math, itertools, string, queue, datetime +import sys, heapq, bisect, math, itertools, string, queue, copy, time -def inpl(): -    return list(map(int, input().split())) +def inp(): +    return int(sys.stdin.readline()) -def inpls(): -    return list(input().split()) +def inpl(): +    return list(map(int, sys.stdin.readline().split())) -N = int(eval(input())) -points = [] +def inpl_str(): +    return list(sys.stdin.readline().split()) + + +N = inp() +ab = [] -    a = int(eval(input())) -    points.append([a, True]) +    a = inp() +    ab.append([a, 1]) -    b = int(eval(input())) -    points.append([b, False]) -points.sort() +    b = inp() +    ab.append([b, -1]) +ab.sort() +cnt = 0 -an = bn = 0 -for x, c in points: -    if c: -        if bn > 0: -            ans = (ans * bn) % mod -            bn -= 1 -        else: -            an += 1 -    else: -        if an > 0: -            ans = (ans * an) % mod -            an -= 1 -        else: -            bn += 1 +for x, k in ab: +    cnt += k +    if (cnt > 0) and (k > 0): +        ans *= cnt +    elif (cnt < 0) and (k < 0): +        ans *= -cnt +    ans %= mod