#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int p[maxn];
int dp[maxn];
int mod = 1000000007;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
    dp[0] = 0;
    dp[1] = 2;
    for (int i = 2; i <= n; i++) {
      dp[i] = dp[i - 1] + dp[i - 1] - dp[p[i] - 1] + 2;
      dp[i] %= mod;
      dp[i] = (dp[i] + mod) % mod;
    }
    int ans = dp[n];
    printf("%d\n", ans % mod);
  }
}
