#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define ls k<<1
#define rs k<<1|1
#define lson k<<1, l, mid
#define rson k<<1|1, mid+1, r
#define lowbit(x) ((x) & (-(x)))
#define ll long long
using namespace std;

struct my_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }

  // 针对 std::pair<int, int> 作为主键类型的哈希函数
  size_t operator()(pair<uint64_t, uint64_t> x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x.first + FIXED_RANDOM) ^
           (splitmix64(x.second + FIXED_RANDOM) >> 1);
  }
};

const ll MOD = 1e9+7;
const int MAX = 3e3+50;
ll a[MAX], sum[MAX], p[MAX][MAX], dp[MAX][MAX];
int n;


int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        sum[i] = sum[i - 1] + a[i];
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            p[i][j] = sum[j] % i;
        }
    }
    for (int i = 1; i <= n; i++) dp[1][i] = 1;
    for (int i = 2; i <= n; i++) {
        unordered_map<ll, ll, my_hash> mp;
        for (int j = i; j <= n; j++) {
            mp[p[i][j - 1]] = (mp[p[i][j - 1]] + dp[i - 1][j - 1]) % MOD;
            dp[i][j] = mp[p[i][j]];
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) ans = (ans + dp[i][n]) % MOD;
    printf("%lld\n", ans);
    return 0;
}
 #include <bits/stdc++.h>
using namespace std;
using ll = long long;
//素数判定　O√N
bool is_prime(long long x)
{
  assert(0<=x);
  if(x<2)
  {
    return false;
  }
  for(long long i=2;i*i<=x;i++)
  {
    if(x%i==0)
    {
      return false;
    }
  }
  return true;
}
template<class T> void chmin(T& a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T& a,T b){
    if(a<b){
        a=b;
    }
}
//約数列挙
vector<ll> enumeration_divisor(ll n){
  vector<ll> res_divisor;
  for(ll i=1;i<=sqrt(n);i++){
    if(n%i==0){
      res_divisor.push_back(i);
      if(i*i!=n){
        res_divisor.push_back(n/i);
      }
    }
  }
  sort(res_divisor.begin(),res_divisor.end());
  return res_divisor;
}
ll mod = 1000000007;
ll n,a[1<<18],p[1<<18],ans=1;
int main(){
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  sort(a+1,a+n+1);
  ll ans=1;
  for(int i=1;i<=n;i++){
    p[i]=a[i]-a[i-1];
  }
  for(int i=1;i<=n+1;i++){
    ans*=(p[i]+1LL);
    ans%=mod;
  }
  cout << ans << endl;
}