#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define inf 100000000000000000
#define rep(i,a) for(ll i=0; i<a; ++i)
#define pb push_back

ll n;
ll a[100005];
ll b[100005];

ll mod = 1000000007;

int main() {
  ios::sync_with_stdio(false);
  cin>>n;
  rep(i,n) {
    cin>>a[i];
  }
  rep(i,n) {
    cin>>b[i];
  }
  sort(a,a+n);
  sort(b,b+n);
  ll ia=0;
  ll ib=0;
  ll x=0, y=0;
  ll ans=1;
  while(ia<n && ib<n) {
    if (a[ia]<b[ib]) {
      if (y==0) {
        x++;
      } else {
        ans*=y;
        ans = ans%mod;
        y--;
      }
      ia++;
    } else {
      if (x==0) {
        y++;
      } else {
        ans*=x;
        ans = ans%mod;
        x--;
      }
      ib++;
    }
  }
  while(ia<n) {
    if (y==0) {
      x++;
    } else {
      ans*=y;
      ans = ans%mod;
      y--;
    }
    ia++;
  }
  while(ib<n) {
    if (x==0) {
      y++;
    } else {
      ans*=x;
      ans = ans%mod;
      x--;
    }
    ib++;
  }
  cout<<ans<<endl;
}
