#include <bits/stdc++.h>
using namespace std;
long long P = 1000000000 + 7;
long long DP[1005];
int main() {
  long long n, x, s = 0, cost;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    DP[i + 1] = 2 * DP[i] - DP[x] + 2;
    DP[i + 1] = (DP[i + 1] + P) % P;
  }
  cout << DP[n + 1] << endl;
  return 0;
}
