#include <bits/stdc++.h>
using namespace std;
long long n;
int second_portal[1001];
long long dp[1001];
int main() {
  ios_base::sync_with_stdio(false);
  long long t = 1;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> second_portal[i];
    dp[1] = 0;
    for (int i = 1; i <= n + 1; i++) {
      dp[i + 1] = ((2 + (2 * (dp[i] % 1000000007)) % 1000000007) % 1000000007 -
                   dp[second_portal[i]] % 1000000007 + 1000000007) %
                  1000000007;
    }
    cout << dp[n + 1] << endl;
  }
  return 0;
}
