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 t = {}
for i = 1, n do t[i] = {io.read("*n"), 1} end
for i = 1, n do t[i + n] = {io.read("*n"), 2} end
table.sort(t, function(x, y) return x[1] < y[1] end)
local ret = 1
local state = 0
for i = 1, 2 * n do
  local cur = t[i]
  if cur[2] == 1 then
    if 0 <= state then
      state = state + 1
    else
      ret = bmul(ret, -state)
      state = state + 1
    end
  else
    if state <= 0 then
      state = state - 1
    else
      ret = bmul(ret, state)
      state = state - 1
    end
  end
end
print(ret)
