#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1e5;
const int INF = 1e9 + 7;
int n, f[MAXN], a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  f[1] = 2;
  for (int i = 2; i <= n; i++) {
    f[i] = 2;
    for (int j = a[i]; j <= i - 1; j++) f[i] = (f[i] + f[j]) % INF;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + f[i]) % INF;
  cout << ans;
  return 0;
}
