#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<(a)<<endl
#define dumparr(a,n) cerr<<#a<<"["<<(n)<<"]="<<(a[n])<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< "]";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,set<T> a){
  os << "{ ";
  for(auto itr=a.begin();itr!=a.end();++itr){
    os<< *itr << " ";
  }
  os<< "}";
  return os;
}
template<class T>
void ans_array(T begin,T end){
  if(begin==end)return;
  auto itr=begin;
  cout<<*itr;
  ++itr;
  for(;itr!=end;++itr){
    cout<<' '<<*itr;
  }
  cout<<endl;
}
template<class T>
void ans_array_newline(T begin,T end){
  if(begin==end)return;
  for(auto itr=begin;itr!=end;++itr){
    cout<<*itr<<endl;
  }
}

const long long MOD = 1000000007;
void solve(long long N, std::vector<long long> A){
  vector<vector<ll>> dp(N+1,vector<ll>(N+1));
  ll rotated[3001];
  dp[0][0]=1;
  auto idx2real = [&](ll x,ll j){
    return ((x+j+1-rotated[j])%(j+1)+j+1)%(j+1);
  };
  REP(N-1){
    Rev(j,i+1){
      ll& tmp=dp[idx2real(A[i+1],j+1)][j+1];
      tmp=(tmp+dp[idx2real(0,j)][j])%MOD;
      rotated[j]=(rotated[j]+A[i+1])%(j+1);
    }
  }
  ll ans=0;
  REP(N){
    ans=(ans+dp[idx2real(0,i)][i])%MOD;
  }
  dump(dp);
  cout<<ans<<endl;
}

int main(){
  cout<<setprecision(1000);
  long long N;
    std::scanf("%lld", &N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        std::scanf("%lld", &A[i]);
    }
  solve(N, std::move(A));
  return 0;
}

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

template<int M>
struct static_mint {
	static_assert(0 < M, "Module must be positive");

	int val;

	static_mint() : val() {}

	static_mint(long long x) : val(x % M) { if (val < 0) val += M; }

	static_mint pow(long long n) const {
		static_mint ans = 1, x(*this);
		for (; n > 0; n /= 2) {
			if (n & 1) ans *= x;
			x *= x;
		}
		return ans;
	}

	static_mint inv() const {
		return pow(M - 2);
	}

	static_mint operator+() const {
		static_mint m;
		m.val = val;
		return m;
	}

	static_mint operator-() const {
		static_mint m;
		m.val = (val == 0 ? 0 : M - val);
		return m;
	}

	static_mint &operator+=(const static_mint &m) {
		if ((val += m.val) >= M) val -= M;
		return *this;
	}

	static_mint &operator-=(const static_mint &m) {
		if ((val -= m.val) < 0) val += M;
		return *this;
	}

	static_mint &operator*=(const static_mint &m) {
		val = (long long) val * m.val % M;
		return *this;
	}

	static_mint &operator/=(const static_mint &m) {
		val = (long long) val * m.inv().val % M;
		return *this;
	}

	friend static_mint operator+(const static_mint &lhs, const static_mint &rhs) {
		return static_mint(lhs) += rhs;
	}

	friend static_mint operator-(const static_mint &lhs, const static_mint &rhs) {
		return static_mint(lhs) -= rhs;
	}

	friend static_mint operator*(const static_mint &lhs, const static_mint &rhs) {
		return static_mint(lhs) *= rhs;
	}

	friend static_mint operator/(const static_mint &lhs, const static_mint &rhs) {
		return static_mint(lhs) /= rhs;
	}

	friend bool operator==(const static_mint &lhs, const static_mint &rhs) {
		return lhs.val == rhs.val;
	}

	friend bool operator!=(const static_mint &lhs, const static_mint &rhs) {
		return lhs.val != rhs.val;
	}

	static_mint &operator++() {
		return *this += 1;
	}

	static_mint &operator--() {
		return *this -= 1;
	}

	static_mint operator++(int) {
		static_mint result(*this);
		*this += 1;
		return result;
	}

	static_mint operator--(int) {
		static_mint result(*this);
		*this -= 1;
		return result;
	}

	template<typename T>
	explicit operator T() const {
		return T(val);
	}

	friend std::ostream &operator<<(std::ostream &os, const static_mint &m) {
		return os << m.val;
	}

	friend std::istream &operator>>(std::istream &is, static_mint &m) {
		long long x;
		return is >> x, m = x, is;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	using mint = static_mint<1000000007>;

	int n;
	cin >> n;

	vector<long long> a(n);
	for (auto &x : a) cin >> x;

	vector<mint> dp(n + 1);
	dp[0] = 1;

	mint ans = 0;
	for (int i = 1; i <= n; i++) {
		vector<mint> new_dp(n + 1), sum_dp(i);

		long long sum = 0;
		sum_dp[0] = dp[0];
		for (int j = 1; j <= n; j++) {
			sum += a[j - 1];
			new_dp[j] = sum_dp[sum % i];
			sum_dp[sum % i] += dp[j];
		}
		dp.swap(new_dp);
		ans += dp.back();
	}
	cout << ans << '\n';
	return 0;
}
