#include <bits/stdc++.h>
using namespace std;
int dp[1005], p[1005], n;
int main() {
  int k, T, i, j, m;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &p[i]);
    }
    dp[1] = 2;
    int ans = 2;
    for (i = 2; i <= n; i++) {
      dp[i] = 1;
      for (j = p[i]; j < i; j++) dp[i] = (dp[i] + dp[j]) % 1000000007;
      dp[i]++;
      ans = (ans + dp[i]) % 1000000007;
    }
    printf("%d\n", ans);
  }
  return 0;
}
