#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int p[1010];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
  }
  int d[1010] = {0};
  d[1] = 2;
  for (int i = 2; i <= n; i++) {
    d[i] += 2;
    for (int j = p[i]; j < i; j++) {
      d[i] += d[j];
      d[i] = d[i] % 1000000007;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += d[i];
    ans = ans % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
