#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0, length = n; i < length; i++)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ep emplace
#define epb emplace_back
#define scll static_cast<long long> 
#define sz(x) static_cast<int>((x).size())
#define pfll(x) printf("%lld\n", x)
#define ci(x) cin >> x
#define ci2(x, y) cin >> x >> y
#define ci3(x, y, z) cin >> x >> y >> z
#define ci4(w, x, y, z) cin >> w >> x >> y >> z
#define co(x) cout << x << endl
#define co2(x, y) cout << x << " " << y << endl
#define co3(x, y, z) cout << x << " " << y << " " << z << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> PQ;
typedef priority_queue<int, vector<int>, greater<int>> PQG;
typedef priority_queue<P> PQP;
typedef priority_queue<P, vector<P>, greater<P>> PQPG;

const int MAX_N = 2e5, MOD = 1e9 + 7, INF = 1e9;
int n;
ll a[3000], sum[3001], dp[3001][3001];

int main() {
    ci(n);
    rep(i, n) ci(a[i]);
    rep(i, n) sum[i + 1] = sum[i] + a[i];
    dp[0][0] = 1;
    rep(i, n) {
        vector<int> v[i + 1];
        rep(j, n + 1) v[sum[j] % (i + 1)].epb(j);
        rep(j, i + 1) {
            ll s = 0;
            rep(k, v[j].size() - 1) {
                s = (s + dp[v[j][k]][i]) % MOD;
                dp[v[j][k + 1]][i + 1] = (dp[v[j][k + 1]][i + 1] + s) % MOD;
            }
        }
    }
    int ans = 0;
    rep(i, n) ans = (ans + dp[n][i + 1]) % MOD;
    co(ans);
    return 0;
}

//ulala
//code by 255
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pll pair<ll, ll>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef __gnu_pbds::tree<ll, __gnu_pbds::null_type, less<ll>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update> yree;
const ll inf = 0x3fff3fff3fff3fff;
const ll N = 3003;
const ll M = 1e9+7;
ll a[N];
ll dp[N][N];
map<ll, ll> ddp;

signed main(){
	cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
	memset(dp, 255, sizeof dp);
	ll n;
	cin >> n;
	for(ll i = 0;i<n;i++){
		cin >> a[i];
	}
	for(ll i = 0;i<n;i++){
		dp[1][i]=1;
	}
	ll res=1;
	for(ll kk=2;kk<=n;kk++){
		ddp.clear();
		ll ec=0;
		for(ll i = 0;i<n;i++){
			ec=(ec+a[i])%kk;
			if(ddp.count(ec)) dp[kk][i]=ddp[ec];
			if(dp[kk-1][i]!=-1) ddp[ec]+=dp[kk-1][i], ddp[ec]%=M;
		}
		if(dp[kk][n-1]!=-1) res+=dp[kk][n-1], res%=M;
	}
	cout<<res;
}