#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 7;
const int mod = 1e9 + 7;
int a[maxn];
int dp[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[1] = 2;
  for (int i = 2; i <= n; i++) {
    dp[i] = 2;
    for (int j = a[i]; j < i; j++) {
      dp[i] = (dp[i] + dp[j]) % mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + dp[i]) % mod;
  }
  cout << ans << "\n";
}
