#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, w, e, r, t = 2, s[1001];
  cin >> q >> w;
  s[0] = 1;
  for (w = 1; w < q; w++) {
    cin >> e;
    e--;
    s[w] = 1;
    for (; e < w; e++) s[w] = (s[w] + s[e] + 1) % 1000000007;
    t = (t + s[w] + 1) % 1000000007;
  }
  cout << t;
  return 0;
}
