#include <bits/stdc++.h>
using namespace std;
double PI = 3.141592653589793;
const double EPS = 1e-9;
const int N = 1e6 + 5;
const long long mod = 1e9 + 7;
const int oo = 1e9;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long dp[1005];
int n;
int t[1005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
  dp[1] = 2;
  for (int i = 2; i <= n; i++) {
    dp[i] = 2;
    for (int j = t[i]; j <= i - 1; j++) dp[i] = (dp[i] + dp[j]) % mod;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[i]) % mod;
  printf("%lld", ans);
}
