#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
long long dp[1008];
long long p[1008];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }
  dp[1] = 0;
  for (int i = 2; i <= n + 1; i++) {
    dp[i] = (((2 * dp[i - 1]) % MOD) + 2 - dp[p[i - 1]]) % MOD;
    if (dp[i] < 0) {
      while (dp[i] < 0) {
        dp[i] += MOD;
      }
    }
  }
  cout << dp[n + 1] % MOD;
}
