#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1e9 + 7;
int main()
{
    vector<pair<int, bool>> A;
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        A.emplace_back(a, true);
    }
    for (int i = 0; i < N; i++) {
        int b; cin >> b;
        A.emplace_back(b, false);
    }
    sort(begin(A), end(A));
    Int ans = 1, cnt = 0;
    for (int i = 0; i < 2*N; i++) {
        if (cnt > 0 && !A[i].second) ans = (ans * abs(cnt)) % MOD;
        if (cnt < 0 &&  A[i].second) ans = (ans * abs(cnt)) % MOD;
        if (A[i].second) cnt++; else cnt--;
    }
    cout << ans << '\n';
    return 0;
}
