import java.util.*; import java.io.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] arr = new int[n + 1]; String[] line = br.readLine().split(" ", n); for (int i = 1; i <= n; i++) { arr[i] = Integer.parseInt(line[i - 1]); } int[] dp = new int[n + 1]; dp[1] = 1; int[][] adds = new int[11][]; for (int i = 1; i <= 10; i++) { adds[i] = new int[i]; } for (int i = 1; i < n; i++) { for (int j = 1; j <= 10; j++) { dp[i] += adds[j][i % j]; dp[i] %= MOD; } if (arr[i] == 1) { adds[1][0] += dp[i]; adds[1][0] %= MOD; } else if (arr[i] <= 10) { dp[i + 1] += dp[i]; dp[i + 1] %= MOD; adds[arr[i]][i % arr[i]] += dp[i]; adds[arr[i]][i % arr[i]] %= MOD; } else { dp[i + 1] += dp[i]; dp[i + 1] %= MOD; for (int j = 1; i + j * arr[i] <= n; j++) { dp[i + j * arr[i]] += dp[i]; dp[i + j * arr[i]] %= MOD; } } } for (int i = 1; i <= 10; i++) { dp[n] += adds[i][n % i]; dp[n] %= MOD; } System.out.println(dp[n]); } }