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]*(51) for _ in range(51)] dp = [0]*N dp[-1] = 1 MOD = 10**9+7 for i in range(N-1,-1,-1): if A[i]>1 and i50: 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,51): cum[k][i%k] += dp[i] cum[k][i%k] %= MOD print(dp[0])