#include <bits/stdc++.h>
const long long P = 1e9 + 7;
using namespace std;
const long long N = 1010;
inline long long read() {
  long long x(0), w(1);
  char c = getchar();
  while (c ^ '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') w = -1, c = getchar();
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
  return x * w;
}
long long n, ans, p[N], f[N];
signed main() {
  n = read();
  for (long long i = 1; i <= n; ++i) p[i] = read();
  f[1] = 2;
  ans = 2;
  for (long long i = 2; i <= n; ++i) {
    for (long long j = p[i]; j < i; ++j) {
      f[i] = (f[i] + f[j]) % P;
    }
    f[i] = (f[i] + 2) % P;
    ans = (ans + f[i]) % P;
  }
  printf("%lld", ans);
  return 0;
}
