#include <bits/stdc++.h>
using namespace std;
long long i, j, n, m, mas[1003], dp[1003], rez;
int main() {
  long long M = 1000000007;
  std::cin.sync_with_stdio(false);
  cin >> n;
  i = 0;
  while (i < n) {
    cin >> mas[i];
    mas[i]--;
    i++;
  }
  i = 0;
  while (i < n) {
    j = mas[i];
    dp[i] = i - j + 1;
    while (j < i) {
      dp[i] += dp[j];
      dp[i] %= M;
      j++;
    }
    i++;
  }
  i = 0;
  while (i < n) {
    rez += dp[i];
    rez %= M;
    i++;
  }
  rez += n;
  cout << rez % M;
  return 0;
}
