#include <bits/stdc++.h>
using namespace std;
int n, p;
long long MOD = (long long)1000000007;
long long sm, dp[1005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &p);
    for (int j = p; j < i; ++j) dp[i] = (dp[i] + dp[j] + 1) % MOD;
    dp[i] = (dp[i] + 1) % MOD;
  }
  sm = 0;
  for (int i = 1; i <= n; ++i) sm = (sm + 1 + dp[i]) % MOD;
  printf("%I64d\n", sm);
  return 0;
}
