#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p[n + 1], ans[n + 1];
  for (int i = 1; i <= n; i++) cin >> p[i];
  ans[0] = 0;
  ans[1] = 2;
  for (int i = 2; i <= n; i++) {
    ans[i] = 2;
    for (int j = p[i]; j < i; j++) ans[i] = (ans[i] + ans[j]) % 1000000007;
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    res = (res + ans[i]) % 1000000007;
  }
  cout << res << endl;
  return 0;
}
