# cf16-exhibition-final-openA - 1D Matching

import sys

input = sys.stdin.readline



def calc(x, y, total):

    MOD = 10 ** 9 + 7

    if y:

        total = (total * y) % MOD

        y -= 1

    else:

        x += 1

    return x, y, total



def main():

    N = int(eval(input()))

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

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

    C = sorted([(i, 1) for i in A] + [(i, 0) for i in B])

    ans, a, b = 1, 0, 0

    for i, t in C:

        if t:  # laptop

            a, b, ans = calc(a, b, ans)

        else:  # power sources

            b, a, ans = calc(b, a, ans)

    print(ans)





if __name__ == "__main__":

    main()
# cf16-exhibition-final-openA - 1D Matching

def calc(x, y, total):

    if y:

        total = (total * y) % MOD

        y -= 1

    else:

        x += 1

    return x, y, total





def main():

    global MOD

    # sort A, B and the lines between A, B shouldn't cross

    # cross <-> not min distance

    N, *AB = list(map(int, open(0)))

    C = sorted([(i, 1) for i in AB[:N]] + [(i, 0) for i in AB[N:]])

    MOD = 10 ** 9 + 7

    ans, a, b = 1, 0, 0

    for i, t in C:

        if t:  # laptop

            a, b, ans = calc(a, b, ans)

        else:  # power sources

            b, a, ans = calc(b, a, ans)

    print(ans)





if __name__ == "__main__":

    main()
# cf16-exhibition-final-openA - 1D Matching
import sys

input = sys.stdin.readline


def calc(x, y, total):
    MOD = 10**9 + 7
    if y:
        total = (total * y) % MOD
        y -= 1
    else:
        x += 1
    return x, y, total


def main():
    N = int(eval(input()))
    A = tuple(map(int, [eval(input()) for _ in range(N)]))
    B = tuple(map(int, [eval(input()) for _ in range(N)]))
    C = sorted([(i, 1) for i in A] + [(i, 0) for i in B])
    ans, a, b = 1, 0, 0
    for i, t in C:
        if t:  # laptop
            a, b, ans = calc(a, b, ans)
        else:  # power sources
            b, a, ans = calc(b, a, ans)
    print(ans)


if __name__ == "__main__":
    main()

# cf16-exhibition-final-openA - 1D Matching
def calc(x, y, total):
    if y:
        total = (total * y) % MOD
        y -= 1
    else:
        x += 1
    return x, y, total


def main():
    global MOD
    # sort A, B and the lines between A, B shouldn't cross
    # cross <-> not min distance
    N, *AB = list(map(int, open(0)))
    C = sorted([(i, 1) for i in AB[:N]] + [(i, 0) for i in AB[N:]])
    MOD = 10**9 + 7
    ans, a, b = 1, 0, 0
    for i, t in C:
        if t:  # laptop
            a, b, ans = calc(a, b, ans)
        else:  # power sources
            b, a, ans = calc(b, a, ans)
    print(ans)


if __name__ == "__main__":
    main()

-import sys - -input = sys.stdin.readline - - -    MOD = 10**9 + 7 -    N = int(eval(input())) -    A = tuple(map(int, [eval(input()) for _ in range(N)])) -    B = tuple(map(int, [eval(input()) for _ in range(N)])) -    C = sorted([(i, 1) for i in A] + [(i, 0) for i in B]) +    global MOD +    # sort A, B and the lines between A, B shouldn't cross +    # cross <-> not min distance +    N, *AB = list(map(int, open(0))) +    C = sorted([(i, 1) for i in AB[:N]] + [(i, 0) for i in AB[N:]]) +    MOD = 10**9 + 7