#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  scanf("%lld", &n);
  long long int arr[n][2];
  long long int arr2[n];
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &arr2[i]);
    arr2[i]--;
  }
  arr[0][0] = 0ll;
  arr[0][1] = 1ll;
  for (long long int i = 1; i < n; i++) {
    arr[i][0] = (arr[i - 1][1] + 1ll) % 1000000007;
    arr[i][0] = arr[i][0] % 1000000007;
    long long int temp = arr2[i];
    long long int temp_ans = 0ll;
    for (long long int j = temp; j < i; j++) {
      temp_ans = (temp_ans + arr[j][1] - arr[j][0] + 1000000007) % 1000000007;
      temp_ans = temp_ans % 1000000007;
    }
    arr[i][1] = (temp_ans + 1) % 1000000007;
    arr[i][1] = arr[i][1] % 1000000007;
    arr[i][1] = (arr[i][1] + (i - temp)) % 1000000007;
    arr[i][1] = arr[i][1] % 1000000007;
    arr[i][1] = (arr[i][1] + arr[i][0]) % 1000000007;
    arr[i][1] = arr[i][1] % 1000000007;
  }
  printf("%lld\n", ((long long int)arr[n - 1][1] + 1) % 1000000007);
  return 0;
}
