n = int(input()) *a, = map(int,input().split()) M = 512 MOD = 10**9+7 laz = [[0]*i for i in range(M)] dp = [0]*(n+1) dp[0] = 1 for i in range(n): for j in range(1,M): dp[i] += laz[j][i%j] dp[i] %= MOD ai = a[i] if ai >= M: for k in range(i+ai,n+1,ai): dp[k] += dp[i] else: laz[ai][i%ai] += dp[i] if ai != 1: dp[i+1] += dp[i] print(dp[n-1]%MOD)