#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t n;
  cin >> n;
  vector<int64_t> p(n);
  for (int64_t i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  vector<int64_t> dp(n, 0);
  for (int64_t i = 0; i < n; i++) {
    dp[i] = 2;
    for (int64_t j = p[i]; j < i; j++) dp[i] = (dp[i] + dp[j]) % 1000000007;
  }
  int64_t ans = 0;
  for (int64_t i = 0; i < n; i++) ans = (ans + dp[i]) % 1000000007;
  cout << ans;
  return 0;
}
