#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[1002];
int p[1002];
int mod = 1000000007;
int main() {
  cin >> n;
  for (int x = 1; x <= n; x++) {
    cin >> p[x];
  }
  dp[1] = 2;
  for (int x = 2; x <= n; x++) {
    dp[x] = 2;
    for (int y = p[x]; y < x; y++) {
      dp[x] += dp[y];
      dp[x] %= mod;
    }
  }
  long long ans = 0;
  for (int x = 1; x <= n; x++) {
    ans += dp[x];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
