#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const int mod = 1e9 + 7;
int ans[N], p[N];
int main() {
  int n, sum;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &p[i]);
    }
    ans[1] = 2;
    for (int i = 2; i <= n; i++) {
      ans[i] = 1;
      for (int j = i; j >= p[i]; j--) {
        ans[i] += ans[j];
        ans[i] %= mod;
      }
    }
    sum = 0;
    for (int i = 1; i <= n; i++) {
      sum += ans[i];
      sum %= mod;
    }
    printf("%d\n", sum);
  }
  return 0;
}
