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