#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  cin >> n;
  int p[1001] = {};
  for (int i = 1; i <= n; ++i) cin >> p[i];
  long long arr[1001] = {};
  arr[1] = 2;
  for (int i = 2; i <= n; ++i) {
    if (p[i] == i)
      arr[i] += 2;
    else {
      arr[i] = 1;
      for (int j = p[i]; j < i; ++j) {
        arr[i] = (arr[i] + arr[j]) % 1000000007;
      }
      ++arr[i];
    }
  }
  long long sum = 0;
  for (int i = 1; i <= n; ++i) sum = (sum + arr[i]) % 1000000007;
  cout << sum;
  return 0;
}
