#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int* a = new int[n];
  long long int* ans = new long long int[n]();
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    ans[i] += 2;
    for (int x = a[i] - 1; x < i; x++) {
      ans[i] = (ans[i] + ans[x]) % 1000000007;
      ;
    }
  }
  long long int sum = 0;
  for (int i = 0; i < n; i++) sum += ans[i];
  cout << sum % 1000000007;
  return 0;
}
