#include<iostream>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<set>
#define ll long long
#define pb push_back
#define forn(i,x,n) for(int i=x;i<=n;++i)
#define forr(i,x,n) for(int i=n;i>=x;--i)
#define lson (rt<< 1)
#define rson (rt<< 1 | 1)
#define gmid ((l+r)>> 1 )
using namespace std;

const int maxn=3050;
const int p=1e9+7;
ll a[maxn];
ll f[maxn][maxn],s[maxn][maxn],b[maxn][maxn];
int main()
{
	int n;
	cin>>n;
	forn(i,1,n)
	  cin>>a[i];
	forn(i,1,n)
	  {
	  	  s[i][0]=s[i-1][0]+a[i];
	  	  forn(j,1,n)
	  	    s[i][j]=(s[i][0]%j);
	  }
	b[0][0]=1;
	forn(i,1,n)
	  forr(j,1,i)
	    {
	    	f[i][j]=b[s[i][j]][j-1];
			b[s[i][j+1]][j]=(b[s[i][j+1]][j]+f[i][j])%p;	
	    }  
	ll ans=0;
	forn(i,1,n)
	  ans=(ans+f[n][i])%p;
	cout<<ans<<endl;  
	  
}

#include<bits/stdc++.h>
#define f first
#define s second
#define int long long
using namespace std;
const int N=3e3+5,mod=1e9+7;
int t,a[N],pref[N],dp[N][N],n;
vector<int>c[N];
 main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		pref[i] = pref[i-1] + a[i] ;
	}
	dp[0][0] = 1;
	int ans = 0;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<=n;j++) {
			c[pref[j]%i].push_back(j);
		}
		for(int j=0;j<i;j++) {
			int p = 0;
			for(int k=0;k<c[j].size();k++) {
				dp[c[j][k]][i] = p;
				p += dp[c[j][k]][i-1]; 
				if(p>=mod) p-=mod;
			}
			c[j].clear();
		}
		ans += dp[n][i];
		if(ans>=mod) ans -= mod;
	}
	cout<<ans;
}
