using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; var th = (int)Math.Sqrt(n); var mod = 1_000_000_007; var dp = new long[n]; dp[0] = 1; var add = new long[th][]; for (var i = 0; i < add.Length; ++i) add[i] = new long[th]; for (var i = 0; i + 1 < n; ++i) { if (a[i] > 1) dp[i + 1] = (dp[i + 1] + dp[i]) % mod; if (a[i] >= th) { for (var j = i + a[i]; j < n; j += a[i]) dp[j] = (dp[j] + dp[i]) % mod; } else { add[a[i]][i % a[i]] = (add[a[i]][i % a[i]] + dp[i]) % mod; } for (var j = 1; j < add.Length; ++j) { dp[i + 1] = (dp[i + 1] + add[j][(i + 1) % j]) % mod; } } WriteLine(dp[^1]); } }