#include<bits/stdc++.h>
typedef int LL;
typedef double dl;
#define opt operator
#define pb push_back
#define pii std::pair<LL,LL>
const LL maxn=1e6+9,mod=1e9+7,inf=0x3f3f3f3f;
LL Read(){
	LL x(0),f(1); char c=getchar();
	while(c<'0' || c>'9'){
		if(c=='-') f=-1; c=getchar();
	}
	while(c>='0' && c<='9'){
		x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar();
	}return x*f;
}
void Chkmin(LL &x,LL y){
	if(y<x) x=y;
}
void Chkmax(LL &x,LL y){
	if(y>x) x=y;
}
LL add(LL x,LL y){
	return x+=y,x>=mod?x-mod:x;
}
LL dec(LL x,LL y){
	return x-=y,x<0?x+mod:x;
}
LL mul(LL x,LL y){
	return 1ll*x*y%mod;
}
LL Pow(LL base,LL b){
	LL ret(1); while(b){
		if(b&1) ret=mul(ret,base); base=mul(base,base); b>>=1;
	}return ret;
}
LL n;
LL a[maxn];
int main(){
	n=Read();
	for(LL i=1;i<=n;++i) a[i]=Read();
	std::sort(a+1,a+1+n);
	LL ret(1);
	for(LL i=0;i<n;++i) ret=mul(ret,a[i+1]-a[i]+1);
	printf("%d\n",ret);
	return 0;
}




#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

const int maxn = 4e5 + 50, INF = 0x3f3f3f3f;

inline int read () {
	register int x = 0, w = 1;
	register char ch = getchar ();
	for (; ch < '0' || ch > '9'; ch = getchar ()) if (ch == '-') w = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar ()) x = x * 10 + ch - '0';
	return x * w;
}

int n, pos[maxn];

struct Node {
	int id, val;
	inline friend bool operator < (register const Node &a, register const Node &b) { return a.val < b.val; }
} a[maxn];

int main () {
	n = read() << 1;
	for (register int i = 1; i <= n; i ++) a[i].id = i, a[i].val = read();
	sort (a + 1, a + n + 1);
	for (register int i = 1; i <= n; i ++) pos[a[i].id] = i;
	register int res = 0;
	for (register int i = 1; i <= n; i ++) {
		if (pos[i] <= n >> 1) {
			if (res >= 0) putchar ('(');
			else putchar (')');
			res ++;
		} else {
			if (res <= 0) putchar ('(');
			else putchar (')');
			res --;
		}
	}
	return putchar ('\n'), 0;
}