#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

const long long P = 1e9 + 7;
const double EPS = 1e-9;

using namespace std;

void solve() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];

  vector<vector<long long>> dp(n, vector<long long>(n + 1));
  // dp[i][j]: num ways for v[0..i] with j segments
  // dp[i][j] = r[SUM(v[0..i]) % j]
  for (int i = 0; i < n; i++)
    dp[i][1] = 1;
  for (int k = 2; k <= n; k++) {
    long long s = 0;
    vector<long long> ct(k, 0);
    for (int i = 0; i < n; i++) {
      s = (s + v[i]) % k;
      dp[i][k] = ct[s];
      ct[s] = (ct[s] + dp[i][k - 1]) % P;
    }
  }
  long long res = 0;
  for (int k = 1; k <= n; k++)
    res = (res + dp[n - 1][k]) % P;
  cout << res << '\n';
}

/*
  YOU CAN DO THIS!! ;)
  1. Note the limits!
  2. Give logical, short variable names
  3. If you are stuck for a long time, skip to next problem
  4. Can't prove a pattern (Esp Game Theory)? Brute force for small numbers and observe!
*/
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  // int t;
  // cin >> t;
  while (t--) {
    solve();
  }
}

#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; debug_print(__VA_ARGS__); } while(false)
template<typename T, typename... Ts> void debug_print(const T &t, const Ts &...ts) { cerr << t; ((cerr << ", " << ts), ...); cerr << endl; }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, const T& b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, const T& b) { if (a < b) {a = b; return true; } return false; }
template<typename T, typename... Ts> void print(const T& t, const Ts&... ts) { cout << t; ((cout << ' ' << ts), ...); cout << '\n'; }
template<typename... Ts> void input(Ts&... ts) { (cin >> ... >> ts); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

template<ll MOD = 1000000007>
class ModInt {
    ll n;
    ModInt constexpr inverse() const {
        return ModInt::pow(*this, MOD - 2);
    }

public:
    ModInt() : n(0) {}
    ModInt(ll _n) : n(((_n % MOD) + MOD) % MOD) {}
    ModInt operator+=(const ModInt &m) {
        n += m.n;
        if (n >= MOD) n -= MOD;
        return *this;
    }
    ModInt operator-=(const ModInt &m) {
        n -= m.n;
        if (n < 0) n += MOD;
        return *this;
    }
    ModInt operator*=(const ModInt &m) {
        n *= m.n;
        if (n >= MOD) n %= MOD;
        return *this;
    }
    ModInt operator/=(const ModInt &m) {
        (*this) *= m.inverse();
        return *this;
    }
    friend ModInt operator+(ModInt t, const ModInt &m) {
        return t += m;
    }
    friend ModInt operator-(ModInt t, const ModInt &m) {
        return t -= m;
    }
    friend ModInt operator*(ModInt t, const ModInt &m) {
        return t *= m;
    }
    friend ModInt operator/(ModInt t, const ModInt &m) {
        return t /= m;
    }
    ModInt operator=(const ll l) {
        n = l % MOD;
        if (n < 0) n += MOD;
        return *this;
    }
    friend ostream &operator<<(ostream &out, const ModInt &m) {
        out << m.n;
        return out;
    }
    friend istream &operator>>(istream &in, ModInt &m) {
        ll l;
        in >> l;
        m = l;
        return in;
    }
    static constexpr ModInt pow(const ModInt x, ll p) {
        ModInt<MOD> ans = 1;
        for (ModInt<MOD> m = x; p > 0; p /= 2, m *= m) {
            if (p % 2) ans *= m;
        }
        return ans;
    }
    static constexpr ll mod() {
        return MOD;
    }
};
using mint = ModInt<>;
mint operator"" _m(unsigned long long m) {
    return mint(m);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    vector<ll> a(n);
    rep(i, 0, n) {
        cin, a[i];
    }
    auto dp = make_v(n + 1, n + 1, 0_m);
    dp[0][0] = 1;
    mint ans = 0;
    vector<ll> sum(n + 1, 0);
    auto mp = make_v(n + 1, n + 1, 0_m);
    rep(i, 0, n) {
        sum[i + 1] = sum[i] + a[i];
        rep(j, 0, n) {
            mp[j][sum[i] % (j + 1)] += dp[i][j];
        }
        rep(j, 0, n) {
            dp[i + 1][j + 1] += mp[j][sum[i + 1] % (j + 1)];
            /*
            rep(k, 0, i + 1) {
                if (sum[i + 1] % (j + 1) == sum[k] % (j + 1)) {
                    dp[i + 1][j + 1] += dp[k][j];
                }
            }
            //*/
        }
    }
    rep(i, 0, n + 1) {
        ans += dp[n][i];
    }
    print(ans);
    return 0;
}
