import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = N.iota.map!(_ => readln.chomp.to!long).array;
    auto B = N.iota.map!(_ => readln.chomp.to!long).array;

    A.sort();
    B.sort();

    long a = 0;
    long b = 0;
    long ans = 1;

    for (int i = 0, j = 0; i < N || j < N; ) {
        if (j == N || (i != N && A[i] < B[j])) {
            if (b == 0) {
                a += 1;
            } else {
                ans = ans * b % MOD;
                b -= 1;
            }
            ++i;
        } else {
            if (a == 0) {
                b += 1;
            } else {
                ans = ans * a % MOD;
                a -= 1;
            }
            ++j;
        }
    }

    ans.writeln;
}
