#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr << "[" << #x << "]: " << x << "\n";

using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using pl = pair<ll, ll>;

ld const PI = 4*atan((ld)1);

template<int MOD = 1'000'000'007>
struct Mint
{
	int val;

	Mint() : val(0) {}
	Mint(ll _val) : val((int)(_val % MOD)) { if (val < 0) val += MOD; }

	Mint& operator+= (const Mint &rhs) { val += rhs.val; if (val >= MOD) val -= MOD; return *this; }
	Mint& operator-= (const Mint &rhs) { val -= rhs.val; if (val < 0) val += MOD; return *this; }
	Mint& operator*= (const Mint &rhs) { val = (int)((ll) val * rhs.val % MOD); return *this; }

	friend Mint fpow(Mint x, ll y)
	{
		Mint res = 1;
		for (; y > 0; y >>= 1, x *= x)
		{
			if (y & 1)
				res *= x;
		}
		return res;
	}
	friend Mint inverse(Mint x) { return fpow(x, MOD-2); }
	Mint& operator/= (const Mint &rhs) { return *this *= inverse(rhs); }

	friend Mint operator+ (Mint a, const Mint &b) { return a += b; }
	friend Mint operator- (Mint a, const Mint &b) { return a -= b; }
	friend Mint operator- (Mint a) { return 0 - a; }
	friend Mint operator* (Mint a, const Mint &b) { return a *= b; }
	friend Mint operator/ (Mint a, const Mint &b) { return a /= b; }
	friend ostream& operator<< (ostream &os, const Mint &a) { return os << a.val; }
	friend bool operator== (const Mint &a, const Mint &b) { return a.val == b.val; }
	friend bool operator!= (const Mint &a, const Mint &b) { return a.val != b.val; }
};

const int MAX = 3069;

int n;
ll ar[MAX], pfx[MAX];
Mint<> dp[MAX][MAX] = {};
Mint<> sum[MAX][MAX] = {};

int main()
{
	fastio;

	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> ar[i], pfx[i] = pfx[i-1] + ar[i];

	dp[0][0] = 1;
	sum[1][0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = i; j >= 1; --j)
		{
			dp[i][j] = sum[j][pfx[i] % j];
			sum[j+1][pfx[i] % (j+1)] += dp[i][j];
			// for (int x : v[j][pfx[i] % j])
			// {
			// 	if (x == i)
			// 		break;
			// 	dp[i][j] += dp[x][j-1];
			// }

			// for (int k = 0; k < i; ++k)
			// {
			// 	if (pfx[i] % j == pfx[k] % j)
			// 		dp[i][j] += dp[k][j-1];
			// }
		}
	}

	// for (int i = 1; i <= n; ++i)
	// {
	// 	for (int j = 1; j <= i; ++j)
	// 		cerr << dp[i][j] << ", ";
	// 	cerr << '\n';
	// }

	Mint<> res = 0;
	for (int i = 1; i <= n; ++i)
		res += dp[n][i];
	cout << res << '\n';

	return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
#define N 3005
#define ll long long
#define mod 1000000007
using namespace std;
ll a[N],sum[N];
int f[N],f2[N],g[N];
int main()
{
	int i,k,n,ans=0;
	scanf("%d",&n);
	for(i=1;i<=n;++i)
		scanf("%lld",&a[i]);
	f[0]=1;
	for(k=1;k<=n;++k)
	{
		memcpy(f2,f,sizeof(f2));
		memset(f,0,sizeof(f));
		memset(g,0,sizeof(g));
		for(i=1;i<=n;++i)sum[i]=(sum[i-1]+a[i])%k;
		g[0]=f2[0];
		for(i=1;i<=n;++i)
		{
			f[i]=g[sum[i]];
			(g[sum[i]]+=f2[i])%=mod;
		}
		(ans+=f[n])%=mod;
	}
	printf("%d\n",ans);
	return 0;
}
