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