#include <bits/stdc++.h>
using namespace std;
long long int memo[1003][2];
int a[1003];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  memo[1][1] = 1;
  memo[1][0] = 2;
  for (int i = 2; i <= n; i++) {
    memo[i][1] = 1 + memo[i - 1][0];
    memo[i][1] %= 1000000007;
    memo[i][0] = 1 + (memo[i][1] - memo[a[i]][1]) + memo[i][1];
    memo[i][0] %= 1000000007;
    if (memo[i][0] < 0) {
      memo[i][0] += 1000000007;
      memo[i][0] %= 1000000007;
    }
  }
  long long int ans;
  ans = memo[n][0];
  ans %= 1000000007;
  printf("%I64d\n", ans);
}
