mod = 10 ** 9 + 7 N = int(input()) A = list(map(int, input().split())) sq = int((2 * N) ** 0.5) + 1 dp = [0] * (N + 1) memo = [[0] * N for _ in range(sq+1)] dp[0] = 1 for i in range(N): a = A[i] for j in range(1, sq + 1): if i - j >= 0: memo[j][i] += memo[j][i-j] memo[j][i] %= mod dp[i] += memo[j][i] dp[i] %= mod if a > sq: for j in range(a + a, N, a): dp[j] += dp[i] dp[j] %= mod else: memo[a][i] += dp[i] memo[a][i] %= mod if a > 1: dp[i+1] += dp[i] dp[i+1] %= mod print(dp[N-1])