#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
int main(void){
    ll n;cin>>n;
    vector<vector<ll>> dp(n+100,vector<ll>(n+100,0)); //i番目までのAをj番目のBに切り分ける組み合わせ
    vector<ll> a(n),c(n+1);                           //cはaの累積和
    rep(i,n){
        cin>>a[i];
        c[i+1]=c[i]+a[i];
    }
    ll res=0;
    dp[1][0]=1;
    rep(i,n){
        for(ll j=n;j>=1;j--){
            dp[j+1][c[i+1]%(j+1)]=(dp[j+1][c[i+1]%(j+1)]+dp[j][c[i+1]%j])%mod;
            if(i==n-1){
                res+=dp[j][c[i+1]%j];
                res%=mod;
            }
        }
    }
    cout<<res<<endl;
}

#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define ini(x, y) memset(x, y, sizeof(x));
#define pb push_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = (int)1e9 + 7;
const int MAX = (int)2e9;
const double PI = acos(-1);

int n; 
ll a[3030], psum[3030][3030];
ll dp[3030][3030];
vector<int> v[3030][3030];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			psum[i][j] = psum[i][j - 1] + a[j];
			psum[i][j] %= i;
		}
		for (int j = 1; j <= n; j++) {
			v[i][psum[i][j]].pb(j);
		}
	}
	for (int i = 1; i <= n; i++) dp[1][i] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (dp[i][j] == 0) continue;
			auto& vec = v[i + 1][psum[i + 1][j]];
			for (auto it = upper_bound(all(vec), j); it != vec.end(); ++it) {
				dp[i + 1][*it] += dp[i][j];
				if (dp[i + 1][*it] >= MOD) dp[i + 1][*it] -= MOD;
			}
		}
	}
	
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += dp[i][n];
	}
	cout << ans % MOD;
}