P = 10 ** 9 + 7 N = int(input()) A = [int(a) for a in input().split()] X = [0] * N X[0] = 1 K = 200 Y = [[0] * a for a in range(K)] for i, a in enumerate(A): s = X[i] + X[i-1] if s >= P: s -= P for j in range(1, K): s += Y[j][i%j] if s >= P: s -= P X[i] = s if a < K: Y[a][i%a] += s if a == 1 and i < N - 1: X[i+1] -= s else: for j in range(i + a, N, a): X[j] += s if X[j] >= P: X[j] -= P print(X[-1])