#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const long long mod = 1e9 + 7;
long long dp[N];
int p[N];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }
  long long ways = 2;
  dp[1] = 2;
  for (int i = 2; i <= n; i++) {
    dp[i] = 2;
    for (int j = p[i]; j < i; j++) {
      dp[i] = (dp[i] + dp[j]);
      if (dp[i] >= mod) dp[i] -= mod;
    }
    ways = (ways + dp[i]);
    if (ways >= mod) ways -= mod;
  }
  cout << ways << '\n';
}
