#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define int long long
#define ld long double
using namespace __gnu_pbds;
using namespace std;

using ll = long long;
 
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << h; if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifndef ONLINE_JUDGE 
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
 
const int N = 3e3 + 5;
const int mod = 1e9 + 7;
const int INF = 1e18;
const double eps = 1e-5;
const double PI = acos(-1);
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct mi {
 	int v; explicit operator int() const { return v; } 
	mi() { v = 0; }
	mi(ll _v):v(_v%mod) { v += (v<0)*mod; }
};
mi& operator+=(mi& a, mi b) { 
	if ((a.v += b.v) >= mod) a.v -= mod; 
	return a; }
mi& operator-=(mi& a, mi b) { 
	if ((a.v -= b.v) < 0) a.v += mod; 
	return a; }
mi operator+(mi a, mi b) { return a += b; }
mi operator-(mi a, mi b) { return a -= b; }
mi operator*(mi a, mi b) { return mi((ll)a.v*b.v); }
mi& operator*=(mi& a, mi b) { return a = a*b; }
mi pow(mi a, ll p) { assert(p >= 0); // asserts are important! 
	return p==0?1:pow(a*a,p/2)*(p&1?a:1); }
mi inv(mi a) { assert(a.v != 0); return pow(a,mod-2); }
mi operator/(mi a, mi b) { return a*inv(b); }

mi dp[N][N];
int prv[N][N];
int s[N], ind[N];

void solve(int tc){
	int n;
	cin >> n;
	vector<mi> a(n+1), pref(n+1);
	for(int i=1; i<=n; i++) cin >> a[i].v;

	memset(dp, 0, sizeof dp);
		
	dp[0][0] = 1;


	for(int k=1; k<=n; k++){
		for(int i=1; i<=n; i++){
			s[i] = (s[i-1] + a[i].v)%k;
		}
		for(int i=0; i<k; i++){
			ind[i] = -1;
		}
		for(int i=0; i<=n; i++){
			prv[k][i] = ind[s[i]];
			ind[s[i]] = i;
		}
	}

	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			if(prv[j][i] != -1){
				dp[i][j] = dp[prv[j][i]][j-1] + dp[prv[j][i]][j];
			}
			// cout << prv[i][j] << ' ';
		}
		// cout << endl;
	}

	mi ans = 0;
	for(int j=1; j<=n; j++)
		ans += dp[n][j];
	cout << ans.v << '\n';
} 
 
int32_t main(){
	fast;
	int tc = 1;
	// cin >> tc;
	for(int tt=1; tt<=tc; tt++){
		solve(tt);
	}
	return 0;
}
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
const ll MOD=1000000007;

int main(){
  int n;cin>>n;
  vector<ll>sum(n+1,0);
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    sum.at(i+1)=sum.at(i)+a;
  }

  vector<vector<int>>idx(n+1,vector<int>(n+1,-1));
  vector<vector<int>>pre(n+1,vector<int>(n+1,-1));
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      idx.at(i).at(j)=pre.at(j).at(sum.at(i)%j);
      pre.at(j).at(sum.at(i)%j)=i;
    }
  }
  
  vector<vector<ll>>dp(n+1,vector<ll>(n+1,0));
  for(int i=1;i<=n;i++)dp.at(i).at(1)=1;
  ll ans=0;
  for(int i=1;i<=n;i++){
    for(int j=i;j<=n;j++){
      if(idx.at(j).at(i)!=-1){
	int x=idx.at(j).at(i);
	dp.at(j).at(i)=dp.at(x).at(i)+dp.at(x).at(i-1);
        dp.at(j).at(i)%=MOD;
      }
    }
    ans+=dp.at(n).at(i);
    ans%=MOD;
  }
  cout<<ans<<endl;
}
