#include <bits/stdc++.h>
int main(void) {
  long long int n, ar[1003], p[1003], i;
  scanf("%lld", &n);
  ar[0] = 0;
  p[0] = 0;
  for (i = 1; i <= n; i++) {
    scanf("%lld", &p[i]);
  }
  for (i = 1; i <= n; i++) {
    ar[i] = ar[i - 1] - ar[p[i] - 1] + 2 + ar[i - 1];
    if (ar[i] < 0)
      ar[i] += 1000000007;
    else if (ar[i] > (1000000007))
      ar[i] %= 1000000007;
  }
  printf("%lld", ar[n]);
  return 0;
}
