#include <bits/stdc++.h>
using namespace std;
long long int dp[3005];
long long int p[3005];
long long int n;
long long int MOD = 1000000007;
int main() {
  memset(dp, 0, sizeof(dp));
  cin >> n;
  for (int i = 1; i <= n; i = i + 1) {
    cin >> p[i];
  }
  long long int sum = 0, i;
  dp[1] = 2;
  for (i = 2; i <= n; i++) {
    if (p[i] == i) {
      dp[i] = 2;
    } else {
      dp[i] = 2;
      int x;
      for (x = p[i]; x < i; x++) {
        dp[i] = (dp[i] + dp[x]) % MOD;
      }
    }
  }
  for (i = 1; i <= n; i = i + 1) {
    sum = (sum + dp[i]) % MOD;
  }
  cout << sum << endl;
}
