#include <bits/stdc++.h>
using namespace std;
long long ans, n, i, j, a[100001], d[100001];
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  d[1] = 2;
  ans = 2;
  for (i = 2; i <= n; i++) {
    d[i] = 2;
    for (j = a[i]; j < i; j++) d[i] = (d[i] + d[j]) % 1000000007;
    ans = (ans + d[i]) % 1000000007;
  };
  cout << ans;
  return 0;
}
