#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
#define pq(T) priority_queue<T,vector<T>,greater<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,0,n) cin >> a[i];
  sort(all(a));
  ll ans = a[0] + 1;
  rep(i,0,n-1) {
    ans *= a[i+1] - a[i] + 1;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(),a.end()
typedef pair<ll,ll> pi;

//__builtin_popcountll(2) (the number of ones in the binary representation)
//__builtin_clz(2) (number of leading zeroes)
//__builtin_ctz(2) (number of trailing zeroes)

/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>*/
// s.find_by_order(k)(returns iterator to kth element), s.order_of_key(k)(number of elements less than number)

ll mod = 1e9+7;
vector<ll> fact(1);
/*vector<ll> spf(10000005), cntPrime(10000005);

void spff(){
    int i;
    for(i=1;i<10000005;i++) spf[i] = i;
    for(i=2;i*i<10000005;i++)
    {
        if(spf[i] != i) continue;
        for(int j = i*i; j < 10000005; j+= i){
            if(spf[j]==j) spf[j] = i;
        }
    }
    for(i=1;i<10000005;i++){
        if(spf[i] != spf[i/spf[i]]){
            cntPrime[i] = cntPrime[i/spf[i]]+1;
        }
        else cntPrime[i] = cntPrime[i/spf[i]];
    }
}
while(spf[a[i]]!=a[i]){
              z=spf[a[i]];
              while(a[i]%z==0) a[i]/=z;
              m[z]++;
          }
          if(a[i]>1) m[a[i]]++;*/
 
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);       
}
 
ll power(ll x, ll y) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}
 
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1; 
    x = x % p; 
  
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p; 
    } 
    return res; 
} 
  
ll modInv(ll n, ll p) 
{ 
    return power(n, p - 2, p); 
} 
 
ll ncr(ll n, ll r) {return (n>=r?(fact[n]*modInv(fact[r],mod))%mod*modInv(fact[n-r],mod)%mod:0);}

ll add(ll a, ll b) {ll z=a+b; if(z>=mod) z -= mod; return z;}
ll mul(ll a, ll b) { return (a*b)%mod;}
ll sub(ll a, ll b) { return (a-b+mod)%mod;}
// LLONG_MAX

int main()
{  
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  ll t=1,n,i,j,m,a,b;
  //cin>>t;
  //fact[0]=1;
  //for(i=1;i<300003;i++)fact[i]=(fact[i-1]*i)%mod;
  while(t--)
  {
      cin>>n;
      ll z=0;
      for(i=0;i<n;i++){
          cin>>a;
          if(a<=10) continue;
          z += a-10;
      }
      cout<<z;
  }
}
