// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define forn(i, s, n)  for(ll i=(ll)s; i<(ll)(n); i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define pll pair<long long int, long long int>
#define pii pair<int, int>
#define pss pair<string, string>
#define ull unsigned long long int
#define lld long double
#define F first
#define S second
#define PI 3.141592653589793238
#define prec(n) fixed<<setprecision(n)
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define itsval(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); itval(_it, args); }
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

void itval(istream_iterator<string> it) {}
template<typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    itval(++it, args...);
}
const ll MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {cout << x << "\n";}
template <typename T>
inline void printvec(T x) {for (auto a : x) cout << a << '\n'; cout << '\n';}
// -----------------------------------------------------------------------

struct custom {
    bool operator()(const pll &p1, const pll &p2)const {

        return p1.F < p2.F;
    }
};

// Calculate a^b % MOD -------------------------------------------------
ll get_pow(ll a, ll b, ll M = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = (res * a) % M;
        a = (a * a) % M;
        b >>= 1;
    }
    return res;
}
// ---------------------------------------------------------------------
const ll N = 3000 + 5, inf = 2e18;
ll dp[N][N];
ll tot[N][N];
void solve()
{
    int n;
    cin >> n;
    vll v(n + 1);
    forn(i, 1, n + 1) cin >> v[i];
    ll sum = 0;
    dp[0][0] = 1;
    forn(i, 0, n + 1)
    {
        sum += v[i];
        forn(j, 1, n + 1)
        {
            ll x = sum % j;
            dp[i][j] += tot[j][x];
            dp[i][j] %= MOD;
        }
        forn(j, 1, n + 1)
        {
            ll x = sum % j;
            tot[j][x] += dp[i][j - 1];
            tot[j][x] %= MOD;
        }
    }

    ll ans = 0;
    forn(i, 0, n + 1)
    {
        ans += dp[n][i];
        ans %= MOD;
    }

    cout << ans;

}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int test = 1;
    //cin >> test;
    clock_t z = clock();
    forn(tes, 0, test)
    {
        solve();
    }
    debug("Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;

const ll MOD = 1000000007;

ll add(ll a, ll b){
    return (a+b)%MOD;
}

ll mul(ll a, ll b){
    return (a*b)%MOD;
}

const ll MAXN = 3000;

ll dpp[MAXN+5];
ll dp[MAXN+5];
ll ima[MAXN+5];

ll a[MAXN+5];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    ll n;
    cin >> n;
    for(ll i=1; i<=n; i++){
        cin >> a[i];
        dpp[i] = 1;
    }
    ll res = 1;
    for(ll turns=2; turns<=n; turns++){
        ll tr = 0;
        for(ll i=0; i<turns; i++) ima[i] = 0;
        for(ll i=1; i<=n; i++){
            tr = (tr+a[i])%turns;
            dp[i] = ima[tr];
            ima[tr] = add(ima[tr], dpp[i]);
        }
        res = add(res, dp[n]);
        for(ll i=1; i<=n; i++) dpp[i] = dp[i];
    }
    cout << res;
    return 0;
}
