#ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PIL = pair<int,ll>;
using PLI = pair<ll,int>;
using PLL = pair<ll,ll>;
using Graph = vector<vector<int>>;
using Cost_Graph = vector<vector<PIL>>;

template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b){a=b;return 1;}return 0;}
#define REP(i,n) for(int i=0;i<int(n);i++)
#define ROUNDUP(a,b) ((a+b-1)/b)
#define YESNO(T) cout<<(T?"YES":"NO")<<endl
#define yesno(T) cout<<(T?"yes":"no")<<endl
#define YesNo(T) cout<<(T?"Yes":"No")<<endl

const int INFint = 1 << 30;
const ll INFLL = 1LL << 60;
const ll MOD = 1000000007LL;
const double pi = 3.14159265358979;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    a.push_back(0);
    ll ans = 1;
    for (int i = 0; i < n; i++){
        ans *= (a[i] - a[i + 1] + 1);
        ans %= MOD;
    }

    cout << ans << endl;
}
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#ifndef JHELPER1_COMMON_H
#define JHELPER1_COMMON_H

#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

typedef long long ll;
using namespace std;

// int max: 2,147,483,647
// long long max: 9,223,372,036,854,775,807
constexpr ll MOD = 1000L * 1000 * 1000 + 7L;
constexpr ll INF = 1000L * 1000 * 1000 * 1000 * 1000 * 1000 + 7L;

#define READ_VEC(v) for(auto &e: v){in >> e;}
#define READ_PAIR_VEC(v) for(auto &e: v){in >> e.first >> e.second;}
#define ALL(c) std::begin(c), std::end(c)
#define for_(i, a, b) for(int i=(a); i<(b); i++)
#define rfor_(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define rep(i, n) for(int i=0; i<(n); i++)
#define rrep(i, n) for(int i=(n)-1; i>=0; i--)

#endif //JHELPER1_COMMON_H


class BARCWrecker {
public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in>>n;
    vector<ll> a(n);
    READ_VEC(a);
    sort(ALL(a));
    ll tot = 1 + a[0];
    rep(i, n-1) {
      tot *= (a[i+1] - a[i] + 1);
      tot %= MOD;
    }
    out << tot<<endl;
  }
};


int main() {
  ios_base::sync_with_stdio(false); // Disable C++ and C sync
  cin.tie(NULL); // Disable cin and cout sync

  BARCWrecker solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
