#include <bits/stdc++.h>
using namespace std;
#define fo(a,b) for(int64_t a=0;a<b;a++)
#define sor(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define ll int64_t
#define mod 1000000007
#define vl vector<int64_t>
#define vc vector<char>
#define vs vector<string>
#define np(vec) next_permutation(vec.begin(),vec.end())==true
#define en endl
#define vvl vector<vector<int64_t>>
#define stl stack<int64_t>
#define qul que<int64_t>
#define ms(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pq priority_queue
#define pql priority_queue<int64_t>
#define pu push
#define pop pop()
#define top top()
#define pqr priority_queue<ll,vector<ll>,greater<ll>>
#define co cout
#define ci cin
#define wh while
#define size size()
#define front front()

int main() {
 ll n;
  cin>>n;
  vl v(n);
  vl v1(n);
  ll a;
  fo(i,n){
    cin>>v.at(i); 
  }
  v1.at(0)=v.at(0);
  fo(i,n-1){
    v1.at(i+1)=v1.at(i)+v.at(i+1);
  }
  vector<vector<ll>> vec(n, vector<ll>(n));
 for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      vec.at(i).at(j)=(v1.at(j))%(i+1);
    }
  }
   vector<vector<ll>> ans(n, vector<ll>(n));
  fo(i,n){
    ans.at(0).at(i)=1;
  }
  fo(i,n-1){
    vl kari(i+2);
    fo(j,n){
      ans.at(i+1).at(j)=kari.at(vec.at(i+1).at(j));
      kari.at(vec.at(i+1).at(j))=(kari.at(vec.at(i+1).at(j))+ans.at(i).at(j))%mod;
    }
  }
  ll f=0;
  fo(i,n){
  f=(f+ans.at(i).at(n-1))%mod;
    
  }
 cout<<f<<en;
}
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)6e18
#define pii pair<ll,ll>
#define mod 1000000007 // 998244353
#define ff first
#define ss second
#define srt(v)  if(!v.empty())sort(v.begin(),v.end())
#define rev(v)  if(!v.empty())reverse(v.begin(),v.end())
#define PI 3.141592653589793238
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}

ll inv_mod(ll x){
    return pow_mod(x,mod-2);
}

const ll N=(ll)3e5;
ll inv[N];
ll fac[N];

void init(){
  fac[0]=1;
  
  for(ll i=1;i<N;i++)
  fac[i]=(i*fac[i-1])%mod;
  
  for(ll i=0;i<N;i++)
  inv[i]=inv_mod(fac[i]);
}

ll ncr(ll n,ll r){
    if(n<r)
    return 0;
    
    if(n==r||r==0)
    return 1LL;
    
    ll x=fac[n];
    ll y=inv[n-r];
    ll z=inv[r];
    
    return ((x*y)%mod*z)%mod;
}
bool test_cases=0;
void solve()
{
  ll n;
  cin>>n;
  
  ll a[n+1];
  for(ll i=1;i<=n;i++)
  cin>>a[i];
  
  ll dp[n+1][n+1];
  
  
  memset(dp,0,sizeof(dp));
  
  ll ans=0;
  
  ll p[n+1]={0};
  
  for(ll i=1;i<=n;i++)
  p[i]=p[i-1]+a[i];
  
  
  for(ll k=1;k<=n;k++){
     ll rem[n+1]={0};
     
     for(ll i=0;i<=n;i++)
     rem[i]=p[i]%k;
     
     ll sum[k]={0};
      
      if(k==1)
      sum[0]=1;
      
      for(ll i=1;i<=n;i++){
         ll x=rem[i];
                
         dp[i][k]+=sum[x];
         
         dp[i][k]%=mod;
         
         sum[x]+=dp[i][k-1];
      
         sum[x]%=mod;
         
         //cout<<"i "<<i<<" "<<"k "<<k<<" "<<dp[i][k]<<endl;
         
      }
  
      ans+=dp[n][k];
      
      ans%=mod;
  }
  
  cout<<ans<<endl;
  
  
}
int main()
{   
     mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
   
   // init();   //factorial calculations
   
   //Start from Here.

  ll t;
  t=1;
  
  if(test_cases)
  cin>>t;
  
  while(t--)
  solve();
//Good Bye!
    return 0;
}