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

const int Maxn = 3005, p = 1e9 + 7;
int n, trans[Maxn][Maxn], maxi[Maxn][Maxn];
long long ans, a[Maxn], sum[Maxn], f[Maxn][Maxn];
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%lld", &a[i]), sum[i] = sum[i - 1] + a[i];
		for (int j = 1; j <= n; j++)
		{
			trans[i][j] = maxi[j][sum[i] % j];
			maxi[j][sum[i] % j] = i;
		}
	}
	f[0][0] = 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			if (trans[i][j] != -1)
				(f[i][j] += f[trans[i][j]][j] + f[trans[i][j]][j - 1]) %= p;
	for (int i = 1; i <= n; i++)
		(ans += f[n][i]) %= p;
	printf("%lld", ans);
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

typedef long long i64;
typedef unsigned long long ui64;
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef pair<i64, i64> pi;

#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)
inline void RI(i64 &i) {scanf("%lld", &(i));}
inline void RVI(vi &v) { for(i64 i=0;i<sz(v);++i) { RI(v[i]); } }
inline void RVVI(vvi &vv) { for(i64 i=0;i<sz(vv);++i) { RVI(vv[i]); } }
inline void WI(const i64 &i) {printf("%lld\n", i);}
inline void WVI(const vi &v, char sep=' ') { for(i64 i=0;i<sz(v);++i) { if(i != 0){ printf("%c", sep); } printf("%lld", v[i]);} printf("\n"); }
inline void WS(const string &s) { printf("%s\n", s.c_str()); }
inline void WB(bool b, const string &yes, const string &no) { if(b){ WS(yes);} else { WS(no);} }
inline void YESNO(bool b) { WB(b, "YES", "NO"); }
inline void YesNo(bool b) { WB(b, "Yes", "No"); }
#define BUF_LENGTH 1000000
inline void RS(string &s) {static char buf[BUF_LENGTH]; scanf("%s", buf); s = buf;}
template<typename T> inline bool IN(T &S, const typename T::key_type &key) {
  return S.find(key) != S.end();
}
template<typename T> inline bool ON(const T &b, i64 idx) {
  return ((T(1) << idx) & b) != 0;
}

template<long long M, typename T=long long>
struct modint {
  modint(T v=T(0)) : val((v >= 0 ? v : (M - ((-v) % M))) % M) {}
  using this_type = modint<M, T>;
  T val;
  this_type operator++(int) {
    this_type ret = *this;
    val++; val %= M;
    return ret;
  }
  this_type operator--(int) {
    this_type ret = *this;
    val += M-1; val %= M;
    return ret;
  }
  this_type &operator++() {
    val++; val %= M;
    return *this;
  }
  this_type &operator--() {
    val += M-1; val %= M;
    return *this;
  }
  this_type operator+() const { return *this; }
  this_type operator-() const { return this_type(M-val); };
  friend this_type operator+(const this_type &lhs, const this_type &rhs) {
    return this_type(lhs) += rhs;
  }
  friend this_type operator-(const this_type &lhs, const this_type &rhs) {
    return this_type(lhs) -= rhs;
  }
  friend this_type operator*(const this_type &lhs, const this_type &rhs) {
    return this_type(lhs) *= rhs;
  }
  friend this_type operator/(const this_type &lhs, const this_type &rhs) {
    return this_type(lhs) /= rhs;
  }
  this_type pow(long long b) const {
    this_type ret = 1, a = *this;    
    while(b != 0) {
      if(b % 2 != 0) {
        ret *= a;
      }
      b /= 2;
      a = a * a;
    }
    return ret;
  }
  this_type inv() const {
    return pow(M-2);
  }
  this_type& operator+=(const this_type &rhs) {
    val += rhs.val; val %= M; return *this;
  }
  this_type& operator-=(const this_type &rhs) {
    val += M - rhs.val; val %= M; return *this;
  }
  this_type& operator*=(const this_type &rhs) {
    val *= rhs.val; val %= M; return *this;
  }
  this_type& operator/=(const this_type &rhs) {
    *this *= rhs.inv(); return *this;
  }
  friend bool operator==(const this_type &lhs, const this_type &rhs) {
    return lhs.val == rhs.val;
  }
  friend bool operator!=(const this_type &lhs, const this_type &rhs) {
    return lhs.val != rhs.val;
  }
  T mod() const {return M;}
};

using mi = modint<1000000007>;
using vmi = vector<mi>;
using vvmi = vector<vmi>;

int main(int argc, char *argv[]) {
  i64 i, j, k;
  i64 N; RI(N);
  vi A(N); RVI(A);

  vvmi ans(N+1, vmi(N+1, 0));
  fill(all(ans[1]), 1);
  ans[1][0] = 0;
  REP(2, N+1, k) {
    vi prev(N+1, -1);

    i64 S = 0;
    vi res(k, -1);
    res[0] = 0;
    REP(1, N+1, i) {
      S += A[i-1];
      S %= k;
      prev[i] = res[S];
      res[S] = i;
    }

    REP(1, N+1, i) {
      ans[k][i] = 0;
      if(prev[i] != -1) {
        ans[k][i] += ans[k][prev[i]];
        ans[k][i] += ans[k-1][prev[i]];
      }
    }
  }

  mi a = 0;
  REP(1, N+1, k) {
    a += ans[k].back();
  }
  WI(a.val);

  return 0;
}

