using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            const long MOD = 1000000007;

            var N = cin.ReadInt();
            var a = new int[N];
            var b = new int[N];
            var all = new List<Pair<int, int>>();
            for (int i = 0; i < N; ++i)
            {
                a[i] = cin.ReadInt();
                all.Add(new Pair<int, int>(a[i], 1));
            }
            for (int i = 0; i < N; ++i)
            {
                b[i] = cin.ReadInt();
                all.Add(new Pair<int, int>(b[i], 2));
            }

            all = all.OrderBy(x => x).ToList();

            var tmp = 0L;
            var ret = 1L;
            foreach (var i in all)
            {
                if (tmp < 0 && i.Second == 1)
                    ret = (-tmp * ret) % MOD;
                else if (tmp > 0 && i.Second == 2)
                    ret = (tmp * ret) % MOD;
                tmp += (i.Second == 1 ? 1 : -1);
            }

            WriteLine(ret);
        }
    }

    public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
        where T1 : IComparable<T1>
        where T2 : IComparable<T2>
    {
        public T1 First;
        public T2 Second;
        public Pair() { First = default(T1); Second = default(T2); }
        public Pair(T1 f, T2 s) { First = f; Second = s; }
        public override string ToString() { return "(" + First + ", " + Second + ")"; }
        public override int GetHashCode()
        {
            var f = First.GetHashCode();
            var s = Second.GetHashCode();
            return ((f << 5) + f) ^ s;
        }
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(this, obj)) return true;
            else if (obj == null) return false;
            var tmp = obj as Pair<T1, T2>;
            return (object)tmp != null && First.Equals(tmp.First) && Second.Equals(tmp.Second);
        }
        public int CompareTo(Pair<T1, T2> obj)
        {
            if (obj == null) return 1;
            var ret = this.First.CompareTo(obj.First);
            if (ret != 0) return ret;
            else return this.Second.CompareTo(obj.Second);
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}


Measured memory_bytes: 36152