#include <stdio.h>
#include <algorithm>
#define mod 1000000007
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans = 1, now = 0;
  scanf("%lld", &n);
  ll a[n], b[n];
  for(i = 0; i < n; ++i) scanf("%lld", &a[i]);
  for(i = 0; i < n; ++i) scanf("%lld", &b[i]);
  std::sort(a, a + n), std::sort(b, b + n);
  for(i = 0; i < n; ++i) {
    if(a[i] < b[i]) {
      while(a[now] < b[i] && now < n) ++now;
      ans *= now - i;
    } else {
      while(b[now] < a[i] && now < n) ++now;
      ans *= now - i;
    }
    ans %= mod;
  }
  printf("%lld", ans);
  return 0;
}