#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll f[3005][3005],a[3005],s[3005],ans=0ll;
ll mod=1e9+7;
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],s[i]=s[i-1]+a[i];
	f[1][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=n;j>=1;j--){
			f[j+1][s[i]%(j+1)]=(f[j+1][s[i]%(j+1)]+f[j][s[i]%j])%mod;
			if(i==n){
				ans=(ans+f[j][s[i]%j])%mod;
			}
		}
	}
	cout<<ans;
}
#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;
}