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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<ll> sll;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))

constexpr ll MOD = 1e9+7;

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T checkmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T checkmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

// constexpr int INF = 1<<25;
// constexpr ll  INF = 1LL<<50;
// int dp[N_MAX][M_MAX] = {}

// Forward declaration
template <typename T>
void dumpContents(const T& v, const string& msg="");

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
constexpr int N_MAX = 1e5+1;

// Calculate aCb mod 1000000007 in O(SIZE)
template<int SIZE>
struct Combination {
  static constexpr long long mod = 1000000007;

  long long inv[SIZE+1];           // modでの逆元
  long long factorial[SIZE+1];     // modでの階乗
  long long invfactorial[SIZE+1];  // modでの階乗の逆元

  Combination() {
    inv[1] = 1;
    // po()を使えばO(N log p)だが、O(N)で計算するアルゴリズム
    for (int i=2; i<=SIZE; i++) {
      inv[i] = mod - (mod/i)*inv[mod%i] % mod;
    }

    factorial[0] = invfactorial[0] = 1;
    for (int i=1; i<=SIZE; i++){
      factorial[i] = factorial[i-1] * i % mod;
      invfactorial[i] = invfactorial[i-1] * inv[i] % mod;
    }
  }

  long long operator()(long long a, long long b) const {
    if (b<0 || a<b) return 0;

    return (invfactorial[b] * invfactorial[a-b]) % mod * factorial[a] % mod;
  }
};

Combination<N_MAX> combi;

struct Line {
  vll v;
  int N;
  int index;

  explicit Line(int _N)
    : v(_N), N(_N), index(0) {}

  ll position() {
    return v[index];
  }
};

void swap(Line* &a, Line* &b) {
   Line *tmp = b;
   b = a;
   a = tmp;
}

struct p {
  int kind;
  int index;
  ll x;
};

int main(int argc, char** argv) {
  int N;
  cin >> N;

  vector<p> points;
  points.reserve(2*N);;

  for (int i=0; i<N; i++) {
    ll a = 0;
    cin >> a;
    points.push_back({0, i, a});
  }
  for (int i=0; i<N; i++) {
    ll a = 0;
    cin >> a;
    points.push_back({1, i, a});
  }

  sort(begin(points), end(points),
       [](const p& lhs, const p& rhs) {
           return lhs.x < rhs.x;
       });

  int ca = 0;
  int cb = 0;
  ll ret1 = 1;

  for (auto q : points) {
    if (q.kind == 0) {
      if (cb == 0) {
        ca += 1;
	continue;
      }

      assert(ca==0);
      ret1 = ret1*cb%MOD;
      cb--;
    } else {
      if (ca == 0) {
        cb += 1;
	continue;
      }
      assert(cb==0);
      ret1 = ret1*ca%MOD;
      ca--;
    }
  }

  cout << ret1 << endl;

  return 0;
}


Measured memory_bytes: 5760