#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define ALL(v) v.begin(), v.end()
typedef pair<int, int> P;
int main() {
	int N;
	cin >> N;
	vector<P> v;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		v.emplace_back(a, 0);
	}
	for (int i = 0; i < N; i++) {
		int b;
		cin >> b;
		v.emplace_back(b, 1);
	}
	sort(ALL(v));
	int x = 0, y = 0;
	ll ans = 1;
	for (P p : v) {
		if (p.second == 0) {
			if (y == 0) {
				x++;
			}
			else {
				(ans *= y) %= MOD;
				y--;
			}
		}
		else {
			if (x == 0) {
				y++;
			}
			else {
				(ans *= x) %= MOD;
				x--;
			}
		}
	}
	cout << ans << endl;
}
