#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 3005


ll N;
ll A[SIZE],rui[SIZE];
ll dp[SIZE][SIZE],memo[SIZE][SIZE];

int main(){

	scanf("%lld",&N);

	rui[0] = 0;
	for(ll i = 0; i < N; i++){

		scanf("%lld",&A[i]);
		rui[i+1] = rui[i]+A[i];
	}

	for(ll i = 0; i <= N; i++){
		for(ll k = 0; k <= N; k++){
			dp[i][k] = 0;
			memo[i][k] = 0;
		}
	}

	dp[0][1] = 1; //dp[index][次のグループ] := 場合の数
	memo[1][0] = 1; //memo[法][剰余] := 場合の数

	for(ll i = 1; i <= N; i++){
		//printf("\ni:%lld\n",i);
		for(ll k = i; k >= 1; k--){

			ll add = memo[k][rui[i]%k];

			dp[i][k+1] += add;
			dp[i][k+1] %= MOD;

			//printf("dp[%lld][%lld]:%lld\n",i,k+1,dp[i][k+1]);

			/*
			 * 位置iがグループkの右端となった
			 * →位置i+1はグループkの左端となることができ、
			 * その判断基準はrui[i]%(k+1)
			 * 累積和なので、基準値は実際の区間の1つ左
			 *
			 * */
			memo[k+1][rui[i]%(k+1)] += add;
			memo[k+1][rui[i]%(k+1)] %= MOD;
		}
	}

	ll ans = 0;

	for(ll i = 1; i <= N+1; i++){ //★NがグループNが右端の時は、次のグループはN+1★

		ans += dp[N][i];
		ans %= MOD;
	}

	printf("%lld\n",ans);

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

void cout_line(vector<int> &a){
    for(int i=0;i<a.size();i++){
        if(i<a.size()-1){
            cout<<a.at(i)<<" ";
        }else{
            cout<<a.at(i)<<endl;
        }
    }
}

signed main(){
    int N; cin>>N;
    vec_int A(N); rep(i,N)cin>>A.at(i);
    int MOD = pow(10, 9) + 7;


    vec_int cumul_A(N+1, 0);
    for(int i=1;i<=N;i++){
        cumul_A.at(i) = cumul_A.at(i-1)+A.at(i-1);
    }

    vector<vec_int> DP(N+1, vec_int(N+1, 0)); // DP.at(i).at(j): j番目の数値までをi個に区切ったときの数
    DP.at(0).at(0) = 1;

    for(int i=0;i<N;i++){

        vec_int cumul_A2(N+1);
        rep(k,N+1)cumul_A2.at(k) = cumul_A.at(k)%(i+1);
        vector<vec_int> inds(i+1);
        vector<vec_int> cumul(i+1);
        rep(k, i+1)cumul.at(k).push_back(0);
        vec_int start_vec(N+1, 0);
        rep(k,N+1){
            inds.at(cumul_A2.at(k)).push_back(k);
            int sz = inds.at(cumul_A2.at(k)).size();
            start_vec.at(k) = sz-1;
            int prev = cumul.at(cumul_A2.at(k)).at(sz-1);
            cumul.at(cumul_A2.at(k)).push_back(prev + DP.at(i).at(k));
        }


        for(int j=1;j<=N;j++){
            // if(DP.at(i).at(j)==0)continue;
            int from = cumul_A2.at(j);
            int start_ind = start_vec.at(j);
            // cout<<i<<" "<<j<<" "<<from<<" "<<start_ind<<" "<<cumul.at(from).at(start_ind)<<endl;
            DP.at(i+1).at(j) += cumul.at(from).at(start_ind);
            DP.at(i+1).at(j) %= MOD;
            /*
            for(int k=start_ind+1; k<inds.at(from).size();k++){
                DP.at(i+1).at(inds.at(from).at(k)) += DP.at(i).at(j);
                DP.at(i+1).at(inds.at(from).at(k)) %= MOD;
            }
            */
        }
    }
    int ans = 0;
    for(int i=1;i<=N;i++){
        ans += DP.at(i).at(N);
        ans %= MOD;
    }
    cout<<ans<<endl;




    return 0;
}