#include <bits/stdc++.h>
int a[1100], dp[1100], n;
void dabiao() {
  int i;
  for (i = 1; i <= n; i++) {
    if (a[i] != i)
      dp[i] = (2 * dp[i - 1] - dp[a[i] - 1] + 2) % 1000000007;
    else
      dp[i] = dp[i - 1] + 2;
    if (dp[i] < 0) dp[i] += 1000000007;
  }
}
int main() {
  int i, j, ans;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  dabiao();
  printf("%d", dp[n]);
}
