#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  long long a[1003], ans[1003], steps = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 0; i <= 1000; i++) ans[i] = 2;
  for (i = 2; i <= n; i++) {
    for (j = a[i]; j < i; j++) {
      ans[i] += ans[j];
      ans[i] %= 1000000000 + 7;
    }
  }
  for (i = 1; i <= n; i++) {
    steps += ans[i];
    steps %= 1000000000 + 7;
  }
  cout << steps << endl;
  return 0;
}
