#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> v(n * 2, vector<int>(2));
	for (int i = 0; i < n; i++)
	{
		cin >> v[i][0];
		v[i][1] = 1;
	}
	for (int i = n; i < n * 2; i++)
	{
		cin >> v[i][0];
		v[i][1] = -1;
	}
	sort(v.begin(), v.end());
	long long ret = 1;
	long long count = 0;
	for (auto x : v)
	{
		if (x[1] < 0)ret *= max(count, -(count - 1));
		ret %= (int)1e9 + 7;
		count += x[1];
	}
	cout << ret << endl;
	return 0;
}
