#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[2000], p[2000], n, i;
  a[0] = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &p[i]);
  for (i = 1; i <= n; i++) {
    a[i] = ((a[i - 1] << 1) - a[p[i - 1] - 1] + 2) % 1000000007;
    if (a[i] < 0) a[i] += 1000000007;
  }
  printf("%d\n", a[n]);
  return 0;
}
