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

#define ll  long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
#define endl "\n"

const ll maxn=3e3+10;
const ll mod =1e9+7 ;
const ll base=3e18;

ll cnt[maxn];
ll f[maxn];
ll dp[maxn];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    if (fopen("t.inp", "r"))
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
    ll n;
     cin>>n ;
     for (int i=1;i<=n;i++)
     {
         ll x;
          cin>> x;
         f[i]=f[i-1]+x;
     }
     ll ans=1;
     for (int j=1;j<=n;j++)
     {
         dp[j]=1;
     }
     for (int k=2;k<=n;k++)
     {
         for (int j=1;j<=n;j++)
         {
             ll pre=dp[j];
            dp[j]=cnt[f[j]%k];
            cnt[f[j]%k]=(cnt[f[j]%k]+pre)%mod;
           // if (k==2) cout <<dp[j]<<" "<<f[j]<<endl;
         }
         for (int j=0;j<=n;j++) cnt[j]=0;
           ans=(ans+dp[n])%mod;
     }
     cout <<ans;

}


#include <bits/stdc++.h>

#define ms(a,b) memset(a, b, sizeof(a))
#define rep(a,b,c) for(int a = (int)(b); a < (int)(c); a++)
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define m_p(a,b) make_pair(a, b)
#define lson l,mid,o << 1
#define rson mid + 1,r,o << 1 | 1
#define ls o << 1
#define rs o << 1 | 1
#define inf 0x3f3f3f3f

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;

inline bool isdigit(char& ch) {
	return ch >= '0' && ch <= '9';
}
template<class T>
void read(T &x) {
	x = 0;
	ll f = 1;char ch = getchar();
	for (;!isdigit(ch);ch = getchar()) 
		if (ch == '-') f = -1;
	for (; isdigit(ch);ch = getchar())
		x = (x << 1) + (x << 3) + ch - '0';
	x *= f;
}
template<class T>
inline void write(T x) {
	if (x == 0) {putchar('0');return ;}
	if (x < 0) {putchar('-');x = -x;}
	int _stk[65],_top = 0;
	for (;x;x /= 10) _stk[++_top] = x % 10 + 48;
	for (;_top;_top--)putchar(_stk[_top]);
}

const int MAXN = 3030;
const ll mod = 1e9 + 7;

ll sum[MAXN], arr[MAXN];
ll dp[MAXN][MAXN], f[MAXN][MAXN];

int main () {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	rep(i, 1, n + 1) {
		cin >> arr[i];
		sum[i] = sum[i-1] + arr[i];
	}
	dp[0][0] = 1;
	rep(i, 1, n + 1) {
		rep(j, 1, i + 1) {
			f[j][sum[i-1] % j] += dp[i-1][j-1];
			f[j][sum[i-1] % j] %= mod;
		}
		rep(j, 1, i + 1) {
			dp[i][j] = f[j][sum[i] % j] % mod;
			/*rep(k, 0, i) {
				dp[i][j] += dp[k][j-1] * ((sum[i] - sum[k]) % j == 0);
				if (dp[i][j] >= mod)
					dp[i][j] -= mod;
			}*/
		}
	}
	ll ans = 0;
	rep(i, 0, n + 1) {
		ans += dp[n][i];
		ans %= mod;
	}
	cout << ans;
	return 0;
}