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