from math import isqrt import numpy as np N = int(input()) A = map(int, input().split()) sq = isqrt(N) MOD = 10 ** 9 + 7 dp = np.zeros(N, dtype=np.int64) dp[0] = 1 small_a = np.zeros((sq, sq), dtype=np.int64) ar = np.arange(1, sq) for i, a in enumerate(A): dp[i] += np.sum(small_a[ar, i % ar]) dp[i] %= MOD if i + 1 < N and a != 1: dp[i + 1] += dp[i] if sq <= a: dp[i + a::a] += dp[i] else: small_a[a, i % a] += dp[i] small_a[a, i % a] %= MOD print(dp[-1] % MOD)