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