import sys input = sys.stdin.readline N=int(input()) A=list(map(int,input().split())) mod=10**9+7 DP=[[0]*(N+1) for i in range(101)] DP[0][0]=1 for i in range(N): a=A[i] for j in range(1,101): if i-j>=0: DP[j][i]+=DP[j][i-j] DP[j][i]%=mod DP[0][i]+=DP[j][i] DP[0][i]%=mod if a>100: for j in range(i+a,N,a): DP[0][j]+=DP[0][i] else: DP[a][i]+=DP[0][i] DP[a][i]%=mod if a!=1: DP[0][i+1]+=DP[0][i] DP[0][i+1]%=mod print(DP[0][N-1])