#include <bits/stdc++.h>
using namespace std;
long long unsigned int dp[1001] = {0};
long long unsigned int sum[1001] = {0};
int main() {
  long long int t, n;
  cin >> n;
  long long int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] != i) {
      t = 0;
      dp[i] = 2;
      for (int j = a[i]; j <= i - 1; j++) {
        t = t + dp[j];
      }
      dp[i] += t;
    } else {
      dp[i] = 2;
    }
    dp[i] = dp[i] % 1000000007;
    sum[i] = sum[i - 1] + dp[i];
    sum[i] = sum[i] % 1000000007;
  }
  cout << sum[n];
}
