N = int(input()) A = list(map(int, input().split())) mod = 10**9 + 7 B = int(N ** 0.5) dp = [0] * N dp_sum = [[0] * B for _ in range(B + 1)] dp[0] = 1 for i in range(N): if i: if A[i - 1] != 1: dp[i] += dp[i - 1] dp[i] %= mod for b in range(1, B + 1): dp[i] += dp_sum[b][i%b] if A[i] <= B: dp_sum[A[i]][i%A[i]] += dp[i] dp_sum[A[i]][i%A[i]] %= mod else: for j in range(i + A[i], N, A[i]): dp[j] += dp[i] dp[j] %= mod print(dp[-1]%mod)