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