#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

using int64 = long long;

const int64 MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;

    vector<pair<int, int>> vec;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        vec.emplace_back(a, -1);
    }
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        vec.emplace_back(b, 1);
    }
    sort(vec.begin(), vec.end());

    int64 ans = 1;
    int64 h = 0;
    for (int i = 0; i < 2 * N; i++) {
        int sec = vec[i].second;
        if (h * sec < 0) (ans *= abs(h)) %= MOD;
        h += sec;
    }
    cout << ans << endl;

    return 0;
}