 #include <bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define ll long long
#define ld long double
#define pb(a) push_back(a)
#define arr(a) new ll int[a]
#define INF 4000000000000000000
#define MOD 1000000007
#define MOD1 998244353
#define MOD2 999979621
#define arr1(a) new arra[a]
#define str(a) new string[a]
#define all(v) v.begin(),v.end()
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define PI 3.14159265
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
void yes(){cout<<"YES"<<endl;}
void no(){cout<<"NO"<<endl;}
//const int N = 200001,p=31;
//ll int pw[N],inv_pw[N],hash2[N+1],hash1[N+1],pw1[N],inv_pw1[N],hash1r[N+1],hash2r[N+1];
//ll fact[N];
//void factorial(ll mod){
//    fact[0] = fact[1] = 1;
//    for(ll i = 2; i < N; i++)
//        fact[i] = (fact[i-1] * i) % mod;
//}
 ll power(ll a, ll b, ll mod){
 	ll x = 1, y = a;
 	while (b > 0){
 		if (b%2){
 			x = (x*y)%mod;
 		}
 		y = (y*y)%mod;
 		b /= 2;
 	}
 	return x%mod;
 }
////////
ll modular_inverse(ll n, ll mod){
	return power(n, mod-2, mod);
}
//void precal()
//{
//    pw[0]=1;
//    pw1[0]=1;
//    inv_pw1[0]=1;
//    inv_pw[0]=1;
//    ll int temp=modular_inverse(p,MOD),temp1=modular_inverse(p,MOD1);
//    for(ll int i=1;i<N;i++)
//    {
//        pw[i]=(pw[i-1]*p)%MOD;
//        pw1[i]=(pw1[i-1]*p)%MOD1;
//        inv_pw1[i]=(inv_pw1[i-1]*temp1)%MOD1;
//        inv_pw[i]=(inv_pw[i-1]*temp)%MOD;
//    }
//}
//void build(string& s,ll int hash1[],ll int pw[],ll int mod)
//{
//    ll int n=s.size();
//    for(ll int i=1;i<=n;i++)
//    {
//        hash1[i]=(hash1[i-1]+(pw[i-1]*(s[i-1]-'a'+1))%mod)%mod;
//    }
//}
//ll int get_hash(ll int hash1[],ll int inv_pw[],ll int mod,ll int l,ll int r)
//{
//    if(l>r)return 0;
//    ll int res=(hash1[r]-hash1[l-1]+mod)%mod;
//    res=(res*inv_pw[l-1])%mod;
//    return res;
//}
//ll nCr(ll n, ll k, ll mod){
//	return (fact[n]*((modular_inverse(fact[k],mod)*modular_inverse(fact[n-k],mod))%mod))%mod;
//}
//typedef struct node{
//    node* left;
//    node* right;
//    ll d;
//}node;
//node* create(ll int i)
//{
//    node* temp=new node;
//    temp->d=i;
//    temp->left=NULL;
//    temp->right=NULL;
//    return temp;
//}
//struct arra{
//    int l,r;
//}arr1[5001];
//bool comp(struct arra a,struct arra b)
//{
//    return (a.d<b.d);
//}
//bool comp1(struct arra a,struct arra b)
//{
//    return (a.h<b.h);
//}
//bool comp1(ll val,struct arra a) //arr.d in increasing order(upperbound comp function
//{
//    return val<a.d;
//}
//bool comp3(struct arra a,ll val) //arr.d in increasing order(lowerbound comp function
//{
//    return a.h<val;
//}
//int dsu[100001],s[100001];
//int find(int a)
//{
//    if(dsu[a]!=a)
//    {
//        dsu[a]=find(dsu[a]);
//    }
//    return dsu[a];
//}
//void add(int a,int b)
//{
//    int x=find(a);
//    int y=find(b);
//    if(x==y)return;
//    if(s[x]>s[y])
//    {
//        dsu[y]=x;
//        s[x]+=s[y];
//    }
//    else{
//        dsu[x]=y;
//        s[y]+=s[x];
//    }
//}
ll n;
ll arr[3001],dp[3002][3002],suff[3002],dp1[3002][3002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif
    cin>>n;
    ll a;
    for(int i=1;i<=n;i++)cin>>arr[i];
    for(int i=n;i>=1;i--)suff[i]=suff[i+1]+arr[i];
    for(int i=1;i<=n;i++)dp1[i][0]=1;
    for(int i=n;i>=1;i--)
    {
        for(int j=i;j>=1;j--)
        {
            a=suff[i]%j;
            dp[i][j]=dp1[j][a];
            dp1[j][a]=(dp1[j][a]+dp[i][j+1])%MOD;
        }
    }
    cout<<dp[1][1];
}

#include <bits/stdc++.h>
    using namespace std;
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
     
    #define fast { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
    #define pb push_back
    #define ll long long
     
    #define vi vector<int>
    #define vll vector<long long>
    #define mp make_pair 
    #define infi INT_MAX
    #define infl LONG_LONG_MAX
    #define infd LDBL_MAX
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define ff first
    #define ss second
    #define pll pair<ll,ll> 
    #define endl "\n"
    #define ALL(v) v.begin(),v.end()
    #define nl cout<<"\n";
    #define pr(x) cout<<x;
    #define pr1(x) cout<<x<<" ";
    #define pr2(x,y) cout<<x<<" "<<y;
    #define deb printf("*****************************\n");
    #define idk printf("idk idk ! \n");
    #define hi printf("hi ! \n");
    #define bye printf("bye bye ! \n");
    #define o_set(ll) tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
    #define number_of_set_bits  __builtin_popcountll  
     
    //template<typename T>
    //#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
    //member functions :
    //1. order_of_key(k) : number of elements strictly lesser than k
    //2. find_by_order(k) : k-th element in the set
     
   const int mod = 1e9 + 7;
     
 ll add(ll a, ll b){
     return (a+b)%mod;
 }
 
 
     int main() 
    {
        fast
        //#ifndef ONLINE_JUDGE
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        //#endif // ONLINE_JUDGE
        
     
        ll ntc=1;
     //  cin>>ntc;
     
        f(ks,1,ntc+1)
        {
          //cout<<"Case #"<<ks<<": ";
          ll n; cin>>n;
          vector<vll> dp(n+1, vll(n+1) );
          dp[0][0] = 1;
          vll v(n+1);
          f(i,1,n+1) cin>>v[i];
          vll psum(n+1);
          f(i,1,n+1) psum[i] = psum[i-1] + v[i];
          
          for(int i = 1; i <=n; ++i){
             dp[i][1] = 1;
          }
          
          for(int j = 2; j <= n; ++j){
              map<ll,ll> m;
              ll sum = 0;
          for(int i = 1; i <=n; ++i){
                ll newsum = (sum + v[i])%j;
                dp[i][j] = add(dp[i][j] , m[newsum]);
                m[newsum] = add(dp[i][j-1],m[newsum]);
                sum =  newsum;
            }
          }
          ll ans = 0;
          f(j,1,n+1) ans = add(ans, dp[n][j]);
         cout<<ans<<endl;
          
        }
     
        return 0;
    }