local mod = 1000000007
local mfl = math.floor
local function bmul(x, y)
  local x0, y0 = x % 31623, y % 31623
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end
local n = io.read("*n")
local a, b = {}, {}
for i = 1, n do a[i] = io.read("*n") end
for i = 1, n do b[i] = io.read("*n") end
table.sort(a)
table.sort(b)
local ret = 1
local cur_a = 1
local cur_b = 1

local function fact(x)
  local r = 1
  for i = 1, x do
    r = bmul(r, i)
  end
  return r
end

while cur_a <= n and cur_b <= n do
  if cur_b <= n then
    local start_a = cur_a
    while cur_a <= n and a[cur_a] <= b[cur_b] do
      cur_a = cur_a + 1
    end
    local len = cur_a - start_a
    ret = bmul(ret, fact(len))
    cur_b = cur_b + len
  end
  if cur_a <= n then
    local start_b = cur_b
    while cur_b <= n and b[cur_b] <= a[cur_a] do
      cur_b = cur_b + 1
    end
    local len = cur_b - start_b
    ret = bmul(ret, fact(len))
    cur_a = cur_a + len
  end
end
print(ret)
