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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define all(a) (a).begin(),(a).end()
#define ODD(x) ( ((x)&1)==0?0:1 )
#define SIGN(x) ( ((x) > 0) - ((x) < 0)  )
#define dbg(x) cerr << #x"= " << x << endl

std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    int n;cin>>n;
    vi a(n);
    FOR(i,n) cin>>a[i];
    sort(all(a));
    ll ret=a[0]+1;
    for(int i=1;i<n;++i){
        ret = ret * (a[i]-a[i-1]+1) % MOD;
    }
    cout << ret;


    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 1000000007;
long long N, A[1 << 18], Q[1 << 18];
long long Answer = 1;

int main() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> A[i];
    sort(A + 1, A + N + 1);
    for(int i = 1; i <= N; i++) Q[i] = A[i] - A[i - 1];

    for(int i = 1; i <= N; i++) {
        Answer *= (Q[i] + 1LL);
        Answer %= mod;
    }

    cout << Answer << endl;
    return 0;
}