#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 100010;
const int MOD = 1000000007;
int n;
int dp[1010];
int to[1010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &to[i]);
  }
  dp[0] = -1;
  for (int i = 1; i <= n; i++) {
    int x = to[i];
    dp[i] = (1LL * dp[i - 1] + 1 + 1 + dp[i - 1] - dp[x - 1] + MOD) % MOD;
  }
  printf("%d\n", (dp[n] + 1) % MOD);
  return 0;
}
