#include <bits/stdc++.h>
using namespace std;
int read(int f = 1, int x = 0, char ch = ' ') {
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
const int N = 1e3 + 5, P = 1e9 + 7;
int n, p[N], f[N];
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) p[i] = read();
  for (int i = 2; i <= n + 1; ++i)
    f[i] = (2ll * f[i - 1] - f[p[i - 1]] + 2 + P) % P;
  printf("%d\n", f[n + 1]);
  return 0;
}
