#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long long int dp[1005] = {0}, n, d[1005], mod = 1000000007, ans = 2;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  dp[1] = 2;
  for (int i = 2; i <= n; i++) {
    if (i == d[i]) {
      dp[i] = dp[i - 1] + 2;
    } else {
      dp[i] = (dp[i - 1] + dp[i - 1] - dp[d[i] - 1] + 2 + mod) % mod;
    }
  }
  cout << dp[n] << endl;
}
