#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define rsrt(v) sort(v.begin(), v.end(), greater<int>())
#define rsrtl(v) sort(v.begin(), v.end(), greater<ll>())
#define fi(i, a, b) for (int i = a; i < b; i++)
#define fll(i, a, b) for (ll i = a; i < b; i++)
#define srt(v) sort(v.begin(), v.end())
#define pb push_back
#define g(v, i, j) get<i>(v[j])
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(),(x).end()
#define ll long long
ll md = 1000000007;
#define theartofwar                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define F first
#define S second
#define sz(v) v.size()
using namespace std;
#define dbg(x) cerr << #x << " = " << x << endl;
template <typename T>
T pw(T a, T b){
    T c = 1, m = a;
    while (b){
        if (b & 1) c = (c * m);
        m = (m * m), b /= 2;
    }
    return c;
}
template <typename T>
T ceel(T a, T b){
    if (a % b == 0)
        return a / b;
    else
        return a / b + 1;
}
template <typename T>
T my_log(T n, T b){
    T i = 1, ans = 0;
    while (1){
        if (i > n){
            ans--;
            break;
        }
        if (i == n) break;
        i *= b, ans++;
    }
    return ans;
}
template <typename T>
T gcd(T a, T b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll pwmd(ll a, ll b){
    ll c = 1, m = a;
    while (b){
        if (b & 1) c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}
ll modinv(ll n){
    return pwmd(n, md - 2);
}
ll inverse(ll i){
    if (i == 1)
        return 1;
    return (md - ((md / i) * inverse(md % i)) % md + md) % md;
}
bool sortbysec(const pair<ll, ll> &a, const pair<ll, ll> &b){
    return (a.second < b.second);
}
int main()
{
    theartofwar;
    ll n, a;
    cin >> n;
    vll v;
    fll(i, 0, n) cin >> a, v.pb(a);
    ll dp[n][n + 1];
    fll(i, 0, n) fll(j, 0, n + 1) dp[i][j] = 0;
    ll last[n + 1][n];
    fll(i, 0, n + 1) fll(j, 0, n) last[i][j] = -1;
    dp[0][1] = 1;
    fll(i, 2, n + 1) last[i][v[0] % i] = 0;
    ll s = v[0];
    fll(i, 1, n){
        dp[i][1] = 1;
        s += v[i];
        fll(j, 2, i + 2){
            ll p = s % j;
            if (last[j][p] == -1) continue;
            ll o = last[j][p];
            dp[i][j] = (dp[i][j] + dp[o][j]) % md;
            dp[i][j] = (dp[i][j] + dp[o][j - 1]) % md;
        }
        fll(j, 2, n + 1) last[j][s % j] = i;
    }
    ll ans = 0;
    fll(i, 1, n + 1) ans = (ans + dp[n - 1][i]) % md;
    cout << ans;
}


#include <cstdio>
long long mod[3005][3005];
long long a[3005];
long long dp[3005][3005];
long long sum[3005][3005];
const long long Mod = 1e9+7;

int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1; i <= n; i++) scanf("%lld",&a[i]);
	for(int i = 1; i <= n; i++){
		mod[0][i] = 0;
		for(int j = 1; j <= n; j++){
			mod[j][i] = (mod[j-1][i] + a[j])%(long long)(i);
			//printf("mod[%d][%d] = %lld\n",i,j,mod[i][j]);
		}
	}
	long long ans = 0;
	dp[0][0] = 1;
	sum[1][0] = sum[1][0] + dp[0][0];
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			dp[i][j] = 0;
			/*
			for(int k = i-1; k >= 0; k--){
				if(mod[i][j] == mod[k][j]){
					dp[i][j] = (dp[i][j] + dp[k][j-1])%Mod;
				}
			}*/
			int left = mod[i][j];
			dp[i][j] = sum[j][left];
			//printf("dp[%d][%d] = %lld\n",i,j,dp[i][j]);
			if(i == n) ans = (ans + dp[i][j])%Mod;
		}
		for(int j = 1; j <= n; j++){
			int tag = mod[i][j+1];
			sum[j+1][tag] = (sum[j+1][tag] + dp[i][j])%Mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}
