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