#include <bits/stdc++.h>
using namespace std;
const int MX = 1005;
int n, a[MX], dp[MX];
const int MOD = 1e9 + 7;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i] = 2;
    if (a[i] < i) {
      for (int j = a[i]; j < i; j++) {
        dp[i] += dp[j];
        dp[i] %= MOD;
      }
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) res += dp[i];
  cout << res % MOD << endl;
  return 0;
}
