#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T1, class T2> inline bool chmax(T1 &a, const T2 &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T1, class T2> inline bool chmin(T1 &a, const T2 &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);cerr<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T> void verr(const set<T> &st) { repa(a, st) cerr << a << " "; cerr << endl; }
template <class S, class T> void verr(const map<S, T> &mp) { repa(a, mp) cerr << "{" << a.first << ", " << a.second << "} "; cerr << endl; }
template <class S, class T, class N> void verr(const vector<pair<S,T>>& a, const N& n) { rep(i, n) cerr << "{" << a[i].first << ", " << a[i].second << "} "; cerr << endl; }
template <class T, class N> void verr(const vector<T>& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << endl; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << endl; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];

    vvc<ll> acc(N + 1, vl(N + 1));
    rep(i, N) {
        repe(j, 1, N + 1){
            acc[i + 1][j] = (acc[i][j] + A[i]) % j;
        }
        
    }

    vvc<ll> dp(N + 1, vl(N + 1));
    vvc<vl> R(N + 1, vvc<ll>(N + 1));

    dp[0][0] = 1;

    vvc<ll> memo(N + 1, vl(N + 1));

    rep(i, N) {
        repe(j, 1, N + 1) {
            if (A[i] % j == 0) {
                (dp[i + 1][j] += dp[i][j] + dp[i][j - 1]) %= MOD;
            } else {
                // repa(id, R[j][acc[i + 1][j]]) {
                //     (dp[i + 1][j] += dp[id][j - 1]) %= MOD;
                // }
                (dp[i + 1][j] += memo[j][acc[i + 1][j]]) %= MOD;
            }
            // R[j][acc[i + 1][j]].eb(i + 1);
            (memo[j][acc[i + 1][j]] += dp[i + 1][j - 1]) %= MOD;
        }
    }

    // rep(i, N + 1)  verr(dp[i], N + 1);
    cout << accumulate(all(dp[N]), 0ll) % MOD << endl;
}
#include<iostream>
#include<vector>
using namespace std;
using ll=long long;
const ll MOD=1000000007;

int main(){
  int n;cin>>n;
  vector<ll>sum(n+1,0);
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    sum.at(i+1)=sum.at(i)+a;
  }

  vector<vector<int>>idx(n+1,vector<int>(n+1,-1));
  vector<vector<int>>pre(n+1,vector<int>(n+1,-1));
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      idx.at(i).at(j)=pre.at(j).at(sum.at(i)%j);
      pre.at(j).at(sum.at(i)%j)=i;
    }
  }
  
  vector<vector<ll>>dp(n+1,vector<ll>(n+1,0));
  for(int i=1;i<=n;i++)dp.at(i).at(1)=1;
  ll ans=0;
  for(int i=1;i<=n;i++){
    for(int j=i;j<=n;j++){
      if(idx.at(j).at(i)!=-1){
	int x=idx.at(j).at(i);
	dp.at(j).at(i)=dp.at(x).at(i)+dp.at(x).at(i-1);
        dp.at(j).at(i)%=MOD;
      }
    }
    ans+=dp.at(n).at(i);
    ans%=MOD;
  }
  cout<<ans<<endl;
}
