#include <bits/stdc++.h>
using namespace std;
int a[1001], f[1001];
int m = 1e9 + 7, res;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[i] = 2;
    for (int j = a[i]; j < i; j++) f[i] = (f[i] + f[j]) % m;
    res = (res + f[i]) % m;
  }
  cout << res;
  return 0;
}
