import sys,os,io input = sys.stdin.readline #input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline N = int(input()) A = list(map(int, input().split())) n = int(N**.5)+1 cum = [[0]*i for i in range(n+1)] dp = [0]*N dp[-1] = 1 MOD = 10**9+7 for i in range(N-1,-1,-1): if A[i]>1 and in: for j in range(i+A[i],N,A[i]): dp[i] += dp[j] else: dp[i] += cum[A[i]][i%A[i]] dp[i] %= MOD for k in range(1,n+1): cum[k][i%k] += dp[i] cum[k][i%k] %= MOD print(dp[0])