#include <bits/stdc++.h>
int n, p[1001], t[1001], r;
int main(void) {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", &p[i]);
  for (i = 1; i <= n; ++i) {
    t[i] = 2;
    for (j = p[i]; j < i; ++j) t[i] = (t[i] + t[j]) % 1000000007;
  }
  for (i = 1; i <= n; ++i) r = (r + t[i]) % 1000000007;
  printf("%d\n", r);
  exit(EXIT_SUCCESS);
}
