#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9;
const long long MOD = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  vector<long long> dp(n + 1);
  dp[0] = 2;
  for (long long i = 1; i < n; i++) {
    for (long long j = p[i]; j < i; j++) {
      dp[i] += dp[j];
    }
    dp[i] += 2;
    dp[i] %= MOD;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += dp[i];
    ans %= MOD;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(12);
  solve();
}
