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

using ll = long long;
const int mod = 1e9+7;

int main(){
    int N; cin >> N;
    vector<ll> A(N), sum(N+1);
    for(int i=0; i<N; i++){
        cin >> A[i];
        sum[i+1] = sum[i]+A[i];
    }
    vector<vector<int>> dp(N+2,vector<int>(N+2));
    dp[1][0]++;
    int ans = 0;
    for(int i=0; i<N; i++){
        for(int j=N; 1<=j; j--){
            dp[j+1][sum[i+1]%(j+1)] += dp[j][sum[i+1]%j];
            dp[j+1][sum[i+1]%(j+1)] %= mod;
            if(i == N-1){
                ans += dp[j][sum[i+1]%j];
                ans %= mod;
            }
        }   
    }
    cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*b);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}
#define num_l(a,v) POSL(a,v) //v未満の要素数
#define num_eql(a,v) POSU(a,v) //v以下の要素数
#define num_h(a,v) (a.size() - POSU(a,v)) //vより大きい要素数
#define num_eqh(a,v) (a.size() - POSL(a,v)) //v以上の要素数

// http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2871291
// https://atcoder.jp/contests/arc017/submissions/10729573
template <typename T>
class Seg_Tree{
public: // 0-index
	vector<T> dat;
	T initial,M;
	int n;
	T unite(T a,T b){//
		return (a + b)%M;
	}
	/*Seg_Tree(int n0_=1,T initial_=1,T M_=1){
		initsize(n0_,initial_,M_);
	}*/
	void initsize(int n0,T initial_,T M_){
		M = M_;
		initial = initial_;
		int k=1;
		while(1){
			if(n0<=k){
				n=k;
				dat.resize(2*n-1);
				for(int i=0;i<2*n-1;i++)dat[i]=initial;
				break;
			}
			k*=2;
		}
	}
 
	//i banme wo x nisuru
	void update(int i,T x){
		i += n-1;
		dat[i] = x;
		while(i>0){
			i = (i-1) / 2;
			dat[i] = unite(dat[i*2+1],dat[i*2+2]);
		}
	}
 
	//[a,b)
	T query0(int a,int b,int k,int l,int r){
		if(r<=a || b<=l)return initial;
		if(a<=l && r<=b)return dat[k];
		else{
			T vl = query0(a,b,k*2+1,l,(l+r)/2);
			T vr = query0(a,b,k*2+2,(l+r)/2,r);
			return unite(vl,vr);
		}
	}
 
	//return [a,b)
	T query(int a,int b){
		return query0(a,b,0,0,n);
	}
};


int main(){

	ll N;
	cin >> N;
	vector<ll> A(N+1,0),sum(N+1,0);
	FOR(i,1,N+1) cin >> A[i];
	FOR(i,1,N+1) sum[i] = sum[i-1] + A[i];

	vector< vector<ll> > dp(N+1,vector<ll>(N+1,0));

	dp[0][0] = 1;


	vector<ll> wa(N+6,0);
	//wa[1] = 1;
	wa[0] = 1;
	vector< Seg_Tree<ll> > Sg();

	FOR(j,1,N+1){ // j個に分ける方法
		FOR(i,1,N+1){ // i個目までで
			(dp[i][j] += wa[ sum[i] % j ]) %= MOD;
			( wa[ sum[i] % j ] += dp[i][j-1] ) %= MOD;
			//(wa[ sum[i] % j ] += dp[i][j]) %= MOD;
		}
		FOR(i,0,N+1)wa[i] = 0;
		//FOR(i,0,N+1)(wa[ sum[i]%(j+1) ] += dp[i][j]) %= MOD;
	}

	ll ans = 0;
	FOR(i,1,N+1){
		( ans += dp[N][i] ) %= MOD;
	}
	cout << ans << endl;
}
