#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long
vector<pair<int, int>>v;
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		v.push_back(make_pair(a, 0));
	}
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		v.push_back(make_pair(a, 1));
	}
	sort(v.begin(), v.end());
	int c0 = 0, c1 = 0;
	int ans = 1;
	for (int i = 0; i < v.size(); i++) {
		if (v[i].second == 1) {
			if (c0 == 0)c1++;
			else {
				ans *= c0;
				c0--;
				ans %= 1000000007;
			}
		}
		else {
			if (c1 == 0)c0++;
			else {
				ans *= c1;
				c1--;
				ans %= 1000000007;
			}
		}
	}
	cout << ans << endl;
}