#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define ll long long
#define rep(i,n) for(int i = 0;i < (int)n;i ++)
#define mod % 1000000007
using namespace std;


int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n+1,0);
  vector<ll> s(n+1,0);
  rep(i,n)cin >> a[i];
  rep(i,n)s[i+1] = a[i]+s[i];
  vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
  ll ans = 0;
  dp[0][0] = 1;
  rep(i,n){
    vector<ll> Q(i+1,0);
    ll S = 0;
    rep(j,n+1){
      dp[i+1][j] = Q[S] mod;
      Q[S] = (Q[S] + dp[i][j]) mod;
      S = (S+a[j])%(i+1);
    }
  }
  rep(i,n+1){
    ans = (ans+dp[i][n]) mod;
  }
  cout << ans << endl;
  return 0;
}
/******************************
Author: jhnah917(Justice_Hui)
g++ -std=c++17 -DLOCAL
******************************/

#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define IDX(v, x) (lower_bound(all(v), x) - v.begin())
using namespace std;

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
constexpr ll MOD = 1e9+7;

ll N, A[3030], S[3030][3030];
int D[3030][3030];
vector<int> G[3030][3030];

void Add(int &a, int b){
    a += b; if(a >= MOD) a -= MOD;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    cin >> N;
    for(int i=1; i<=N; i++) cin >> A[i];
    for(int i=1; i<=N; i++){
        partial_sum(A+1, A+N+1, S[i]+1);
        for(int j=1; j<=N; j++) S[i][j] %= i;
        for(int j=1; j<=N; j++) G[i][S[i][j]].push_back(j);
    }
    for(int i=1; i<=N; i++) D[1][i] = 1;
    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            if(!D[i][j]) continue;
            auto &vec = G[i+1][S[i+1][j]];
            for(auto it=upper_bound(all(vec), j); it!=vec.end(); ++it) Add(D[i+1][*it], D[i][j]);
        }
    }
    ll ans = 0;
    for(int i=1; i<=N; i++) ans += D[i][N];
    cout << ans % MOD;
}