#include <bits/stdc++.h>
using namespace std;
int ara[1005], cnt[1005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> ara[i];
  cnt[1] = 2;
  for (int i = 2; i <= n; i++) {
    cnt[i] = 2;
    for (int k = ara[i]; k < i; k++) {
      cnt[i] += cnt[k];
      if (cnt[i] >= 1000000007) cnt[i] -= 1000000007;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += cnt[i];
    if (ans >= 1000000007) ans -= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
