#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    const int mod=1e9+7;
    int n,ans=0;
    cin>>n;
    vector<long long>sum(n+1);
    vector<vector<int> >lst(n+1,vector<int>(n+1)),dp(n+1,vector<int>(n+1));
    for(int i=1;i<=n;i++) {
        long long v;
        cin>>v;
        sum[i]=sum[i-1]+v;
    }
    lst[1][0]=dp[0][0]=1;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=n;j++)
            dp[i][j]=lst[j][sum[i]%j];
        for(int j=2;j<=n;j++)
            lst[j][sum[i]%j]=(lst[j][sum[i]%j]+dp[i][j-1])%mod;
    }
    for(int i=1;i<=n;i++) ans=(ans+dp[n][i])%mod;
    cout<<ans;
    return 0;
}
#include<bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef long double f128;
using namespace std;

template<typename T>
void scan(T& n){
  cin>>n;
}

void scan(){}

template<typename T,class... Args>
void scan(T& n,Args&... args){
  scan(n);
  scan(args...);
}

template<typename T>
void scanall(T start,T end){
  for(;start!=end;++start){
    scan(*start);
  }
}

template<typename T>
void print(T n){
  cout<<n;
}

void print(){}

template<typename T,class... Args>
void print(T n,Args... args){
  print(n);
  print(args...);
}

template<typename T>
void println(T n){
  print(n);
  cout<<endl;
}

template<typename T,class... Args>
void println(T n,Args... args){
  print(n,' ');
  println(args...);
}

template<typename T>
void printall(T start,T end){
  if(start!=end){
    print(*start);
    for(++start;start!=end;++start){
      print(' ',*start);
    }
  }
  cout<<endl;
}

template<typename T>
void chmax(T& n,T m){
  n=max(n,m);
}

template<typename T>
void chmin(T& n,T m){
  n=min(n,m);
}

template<typename T,typename U>
T power(T a,U n){
  T res=1;
  while(n){
    res*=(n&1)?a:1;
    a*=a;
    n>>=1;
  }
  return res;
}

template<typename T>
struct combination{
  vector<T> fact;
  combination(const int Max=3000000):fact(Max+1,1){
    for(int i=2;i<=Max;++i){
      fact[i]=fact[i-1]*i;
    }
  }
  template<typename U>
  T nCk(U n,U k){
    if(n<k||n<0||k<0){
      return 0;
    }
    return fact[n]/fact[k]/fact[n-k];
  }
};

void solve();

int main(){
  cout<<fixed<<setprecision(15);
  bool is_multicase=false;
  int T=1;
  if(is_multicase){
    scan(T);
  }
  for(int i=0;i<T;++i){
    solve();
  }
  return 0;
}

template<u64 mod>
struct modint{
  u64 val;
  constexpr modint(const i64 x=0) noexcept:val((x%i64(mod)+i64(mod))%i64(mod)){}
  constexpr u64 &value() noexcept{
    return val;
  }
  constexpr modint operator+(const modint rhs) const noexcept{
    return modint(*this)+=rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept{
    return modint(*this)-=rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept{
    return modint(*this)*=rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept{
    return modint(*this)/=rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept{
    val+=rhs.val;
    val-=((val>=mod)?mod:0);
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept{
    val+=((val<rhs.val)?mod:0);
    val-=rhs.val;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept{
    val=val*rhs.val%mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept{
    u64 exp=mod-2;
    while(exp){
      if(exp&1){
        (*this)*=rhs;
      }
      rhs*=rhs;
      exp>>=1;
    }
    return *this;
  }
  friend constexpr ostream &operator<<(ostream &os,const modint &x) noexcept{
    return os<<(x.val);
  }
  friend constexpr istream &operator>>(istream &is,modint &x) noexcept{
    u64 t;
    is>>t;
    x=t;
    return is;
  }
};

void solve(){
  typedef modint<1000000007> mint;
  int N;
  scan(N);
  vector<i64> A(N);
  scanall(A.begin(),A.end());
  vector<i64> csum(N+1);
  for(int i=1;i<=N;++i){
    csum[i]=csum[i-1]+A[i-1];
  }
  vector<vector<mint>> dp(N+1,vector<mint> (N+1));
  dp[0][0]=1;
  for(int i=1;i<=N;++i){
    vector<i64> rem(N+1);
    for(int j=0;j<=N;++j){
      rem[j]=csum[j]%i;
    }
    vector<vector<int>> vec(i);
    for(int j=0;j<=N;++j){
      vec[rem[j]].emplace_back(j);
    }
    for(int j=0;j<i;++j){
      for(size_t k=1;k<vec[j].size();++k){
        dp[i][vec[j][k]]=dp[i-1][vec[j][k-1]]+dp[i][vec[j][k-1]];
      }
    }
  }
  mint ans=0;
  for(int i=1;i<=N;++i){
    ans+=dp[i][N];
  }
  println(ans);
}