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