
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



int main(){
    
    int N;
    cin>>N;
    vector<ll> A(N+1);
    
    ll a;
    
    for(int i=1;i<=N;i++){
        cin>>a;
        A[i]=a+A[i-1];
    }
    
    vector<vector<ll> >dp(N+1,vector<ll>(N+1,0));
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++){
            dp[i][j]=A[j]%i;
        }
    }
    
    vector<vector<mint> > g(N+1,vector<mint>(N+1,0));
    for(int i=1;i<=N;i++){
        g[1][i]=1;
    }
    
    for(int i=2;i<=N;i++){
        map<ll,ll> mp1;
        map<ll,mint> mp2;
        for(int j=i-1;j<=N;j++){
            mp1[dp[i][j]]++;
            if(mp1[dp[i][j]]>1){
               
                g[i][j]=mp2[dp[i][j]];
               
            };
            mp2[dp[i][j]]+=g[i-1][j];
        }
        /*
        cout<<"i: "<<i<<" ";
        for(auto a:mp1){
            cout<<a.first<<" "<<a.second<<endl;
        }
         */
    }
    
    mint ans=0;
    
    for(int i=0;i<=N;i++){
        ans+=g[i][N];
    }
    
    
    cout<<ans<<endl;
    /*
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            cout<<g[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<" A "<<endl;
    for(int i=0;i<=N;i++){
       
            cout<<A[i]<<" ";
     
    
    }
    cout<<endl;
    
    cout<<" dp "<<endl;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }
     */
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    ll N;
    cin>>N;
    v A(N),sA(N,0);
    rep(i,0,N)cin>>A[i];
    sA[0]=A[0];
    rep(i,1,N){
        sA[i]=sA[i-1]+A[i];
    }
    vv dp(N,v(N,0));
    rep(i,0,N)dp[0][i]=1;

    rep(i,1,N){
        ll NM = i+1;
        v mods(NM,0);
        mods[sA[i-1]%NM]+=dp[i-1][i-1];
        mods[sA[i-1]%NM]%=MOD;
        rep(j,i,N){
            dp[i][j] += mods[sA[j]%NM];
            dp[i][j] %=MOD;
            mods[sA[j]%NM]+=dp[i-1][j];
            mods[sA[j]%NM] %=MOD;
        }
    }

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