#include using namespace std; constexpr int mod = 1e9 + 7; constexpr int S = 320; int main() { int N; cin >> N; vector A(N), dp1(N); for (auto& x : A) cin >> x; dp1[0] = 1; vector> dp2(S); for (int i = 0; i < S; i++) dp2[i] = vector(i); for (int i = 0; i < N; i++) { for (int j = 1; j < S; j++) (dp1[i] += dp2[j][i % j]) %= mod; if (A[i] < S) (dp2[A[i]][i % A[i]] += dp1[i]) %= mod; else for (int j = i + A[i]; j < N; j += A[i]) (dp1[j] += dp1[i]) %= mod; if (A[i] != 1 && i != N-1) (dp1[i+1] += dp1[i]) %= mod; } cout << dp1[N-1] << endl; }