#include <bits/stdc++.h>
using namespace std;
long long n;
long long P[100005];
long long pre[100005];
long long dp[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long t;
    cin >> t;
    P[i] = t;
  }
  dp[1] = 2;
  pre[1] = 2;
  for (int i = 2; i <= n; i++) {
    dp[i] = (pre[i - 1] - pre[P[i] - 1] + 2) % 1000000007;
    if (dp[i] < 0) dp[i] += 1000000007;
    pre[i] = (pre[i - 1] + dp[i]) % 1000000007;
  }
  cout << pre[n] << endl;
  return 0;
}
