#include <bits/stdc++.h>
using namespace std;
int main() {
  int dp[1000];
  int n;
  while (cin >> n) {
    int i;
    int a[1000];
    memset(dp, 0, sizeof(dp));
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    for (i = 1; i <= n; i++) {
      int flag = a[i];
      while (flag != i) {
        dp[i] = (dp[i] + dp[flag]) % 1000000007;
        if (flag != i) flag++;
      }
      dp[i] = (dp[i] + 2) % 1000000007;
    }
    int ans = 0;
    for (i = 1; i <= n; i++) ans = (ans + dp[i]) % 1000000007;
    cout << ans << endl;
  }
  return 0;
}
