#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
int n, e;
vector<int> p;
long long arr[1234];
int main() {
  while (cin >> n) {
    p.clear();
    for (int i = 0; i < n; i++) {
      cin >> e;
      e--;
      p.push_back(e);
    }
    arr[0] = 2;
    for (int i = 1; i <= n; i++) {
      arr[i] = 2;
      for (int k = p[i]; k < i; k++) {
        arr[i] = (arr[i] + arr[k]) % mod;
      }
    }
    for (int i = 1; i <= n; i++) {
      arr[i] += arr[i - 1];
    }
    cout << arr[n - 1] % mod << endl;
  }
  return 0;
}
