#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int n, m, s, dr = 0, dp[100101], a[100100], ans;
int main() {
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[1] = 0;
  for (long long int i = 1; i <= n; i++) {
    dp[i + 1] = 2 * (dp[i] + 1) - dp[a[i]];
    dp[i + 1] %= mod;
    if (dp[i + 1] < mod) dp[i + 1] += mod;
  }
  cout << dp[n + 1] % mod << endl;
}
