#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>
//#pragma GCC optimize "trapv"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define fast_az_fuk      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll               long long
#define lll              __int128
#define ull              unsigned ll
#define ld               long double 
#define pb               push_back 
#define pf               push_front
#define dll              deque<ll> 
#define vll              vector<ll>
#define vvll             vector<vll> 
#define pll              pair<ll,ll> 
#define vpll             vector<pll>
#define dpll             deque<pll>
#define mapll            map<ll,ll>
#define umapll           umap<ll,ll>
#define endl             "\n" 
#define all(v)           v.begin(),v.end() 
#define ms(a,x)          memset(a,x,sizeof(a))
#define random(l,r,T)    uniform_int_distribution<T>(l,r)(rng)


//#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//using namespace __gnu_pbds;

#ifdef LOCAL
    #include <debug.h>
#endif

template<typename T> istream& operator >>(istream &in,vector<T> &v){ for(auto &x:v) in>>x; return in;}
template<typename T> ostream& operator <<(ostream &out,const vector<T> &v){ for(auto &x:v) out<<x<<' '; return out;}
template<typename T1,typename T2> istream& operator >>(istream &in,pair<T1,T2> &p){ in>>p.first>>p.second; return in;}
template<typename T1,typename T2> ostream& operator <<(ostream &out,const pair<T1,T2> &p){ out<<p.first<<' '<<p.second; return out;}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template<class T, class H>using umap=unordered_map<T,H,custom_hash>;
template<class T>using uset=unordered_set<T,custom_hash>;


const ll MOD = 1e9 + 7;
int32_t main()
{
    #ifdef LOCAL
        freopen("error.txt", "w", stderr);
        clock_t clk = clock();
    #endif
    fast_az_fuk
    ll n; cin>>n; vll a(n); cin>>a; a.insert(a.begin(),0);
    vvll pre(n+1,vll(n+1));
    for(int i=1;i<=n;i++){
        vll last(n+1,0);
        int j=1; ll sum = 0;
        while(j <= n){
            sum += a[j];
            pre[i][j] = last[sum%i];
            last[sum%i] = j; j++;
        }
    }
    vvll dp(n+1,vll(n+1));
    dp[0][0] = 1;
    for(int i=1;i<=n;i++){
        dp[i][1] = 1;
        for(int j=2;j<=n;j++){
            dp[i][j] = (dp[i][j] + dp[pre[j][i]][j])%MOD;
        }
        if(i == n) break;
        for(int j=n;j>=2;j--){
            dp[i][j] = (dp[i][j-1] + dp[pre[j][i]][j]) % MOD;
        }
    }
    ll ans = 0;
    for(int i=n;i>=1;i--){
        ans = (ans + dp[n][i])%MOD;
    }
    cout<<ans<<endl;
    #ifdef LOCAL
        cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
    #endif
    return 0;
}