#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
long long a[1009] = {0};
long long dp[1009] = {0};
int main() {
  int i, j, k;
  int n;
  scanf("%d", &n);
  for (i = (1) - ((1) > (n + 1)); i != (n + 1) - ((1) > (n + 1));
       i += 1 - 2 * ((1) > (n + 1))) {
    scanf("%lld", &a[i]);
  }
  long long ans = 2;
  dp[1] = 2;
  for (i = (2) - ((2) > (n + 1)); i != (n + 1) - ((2) > (n + 1));
       i += 1 - 2 * ((2) > (n + 1))) {
    for (j = (a[i]) - ((a[i]) > (i)); j != (i) - ((a[i]) > (i));
         j += 1 - 2 * ((a[i]) > (i))) {
      dp[i] = (dp[i] + dp[j]) % 1000000007;
    }
    dp[i] = (dp[i] + 2) % 1000000007;
    ans = (ans + dp[i]) % 1000000007;
  }
  printf("%lld", ans);
  printf("\n");
  return 0;
}
