#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define FOR(i, m, n) for (ll i(m); i < n; i++)
#define DWN(i, m, n) for (ll i(m); i >= n; i--)
#define REP(i, n) FOR(i, 0, n)
#define DW(i, n) DWN(i, n, 0)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
#define D(n) DW(i, n)
#define DD(n) DW(j, n)
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using tll = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using vtll = vector<tll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
void add_edge(gr&g,ll x, ll y){ g[x].pb(y);g[y].pb(x); }
void add_edge(wgr&g,ll x, ll y, ll z){ g[x].eb(y,z);g[y].eb(x,z); }
template<typename T,typename U>
ostream& operator<<(ostream& os, const pair<T,U>& p) { 
    cerr << ' ' <<  p.x << ',' << p.y; return os; }
template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
template <typename T> 
ostream& operator<<(ostream& os, const set<T>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
template<typename T,typename U>
ostream& operator<<(ostream& os, const map<T,U>& v) { 
    for(auto x: v) os << ' ' <<  x; return os; }
struct d_ {
    template<typename T> d_& operator,(const T& x) {
        cerr << ' ' <<  x; return *this;}
} d_t;
#define dbg(args ...) { d_t,"|",__LINE__,"|",":",args,"\n"; }
#define deb(X ...) dbg(#X, "=", X);
#define EPS (1e-10)
#define INF (1LL<<61)
#define YES(x) cout << (x ? "YES" : "NO") << endl;
#define CL(A,I) (memset(A,I,sizeof(A)))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

const ll MOD = 1e9+7;
ll mod(ll a, ll b = MOD) {
  return ((a%b)+b)%b;
}
ll extended_euclid(ll a, ll b, ll &x, ll &y) {
    if (a == 0) { x=0; y=1; return b;}
    ll x1,y1;
    ll d = extended_euclid(b%a, a, x1, y1);
    x = y1-(b/a)*x1; y = x1;
    return d;
}
ll mod_inverse(ll a, ll m=MOD) {
  ll x, y;
  ll d = extended_euclid(a, m, x, y);
  if (d > 1) return -1;
  return mod(x, m);
}
ll mod_power(ll a, ll p, ll m=MOD) {
    ll res = mod(1,m), x=mod(a,m);
    while ( p ) {
        if ( p & 1 ) res = ( res * x ) % m;
        x = ( x * x ) % m; p >>= 1;
    }
    return res;
}
struct Mt {
    ll x = 0;
    Mt(){}
    Mt(ll y):x(mod(y)){}
    bool operator==(Mt &y){return x==y.x;}
    Mt operator+(Mt y){return mod(x+y.x);}
    Mt operator-(){return mod(-x);}
    Mt operator-(Mt y){return mod(x-y.x);}
    Mt operator*(Mt y){return mod(x*y.x);}
    Mt operator/(Mt y){return mod(x*mod_inverse(y.x));}
    Mt operator^(ll y){return mod_power(x, y);}
    Mt operator+=(Mt y){return x=(*this+y).x;}
    Mt operator-=(Mt y){return x=(*this-y).x;}
    Mt operator*=(Mt y){return x=(*this*y).x;}
    Mt operator/=(Mt y){return x=(*this/y).x;}
    Mt operator^=(ll y){return x=(*this^y).x;}
};
ostream& operator<<(ostream& os, const Mt&m){
    os << m.x; return os;
}

const ll N = 3e3+7;
ll n;
ll a[N];
ll sm[N];
Mt dp[N][N]; 
// dp(i,j): how many ways to partition a[0:i] into j blocks
//  = sum(dp(k,j-1) if sum(a[k:i])%j == 0
//  = 1 if j==1
Mt m[N];
// m[x] = sum of dp[k][j-1] s.t. sm[i]%j == x and k<i

int main(void) {
    ios_base::sync_with_stdio(false);
    cin >> n;
    F(n) cin >> a[i];
    F(n) sm[i] = a[i] + (i?sm[i-1]:0);
    F(n) dp[i][1] = 1;
    FOR(j,2,n+1) {
        CL(m,0);
        F(n) {
            dp[i][j] = m[sm[i]%j];
            m[sm[i]%j] += dp[i][j-1];
        }
    }
    Mt ret = 0;
    FOR(j,1,n+1) ret += dp[n-1][j];
    cout << ret << endl;
    return 0;
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define all(x) (x).begin() , (x).end()

void dbg(){
	cerr << endl;
}
template<typename Head , typename... Tail>
void dbg(Head h , Tail... t){
	cerr << h << " ";
	dbg(t...);
}

#ifdef EMBI_DEBUG
#define debug(...) cerr << "(" << #__VA_ARGS__  << "): ", dbg(__VA_ARGS__)
#else 
#define debug(...)
#endif

const int max_n = 1e5 + 9;
const int inf = 1e9;
const int mod = 1e9 + 7;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
void solve(){
	int n;
    cin >> n;
    vll a(n);
    for(int i = 0 ; i < n ; i++) {
        cin >> a[i];
    } 

    ll sum = 1;
    ll dp[n][n+1];
    memset(dp , 0 , sizeof(dp));
    for(int i = 0 ; i < n ; i++) {
        dp[i][1] = 1;
    }

    for(int j = 2 ; j <= n ; j++) {
        int b[n] , dp1[n];
        memset(dp1, 0 , sizeof(dp1));
        for(int i = 0 ; i < n ; i++) {
            b[i] = a[i] % j;
        }
        int curr_rem = 0;
        for(int i = 0 ; i < n ; i++) {
            curr_rem += b[i];
            curr_rem %= j;
            dp[i][j] = dp1[curr_rem];
            dp1[curr_rem] += dp[i][j-1];
            dp1[curr_rem] %= mod;
        }
        sum += dp[n-1][j];
        sum %= mod;
    }

    cout << sum << "\n";
}
signed main(){
	int t = 1;
	// cin >> t;
	for(int i = 1 ; i <= t ; i++){
		solve();
	}
}