#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int maxn = 1e17;
unsigned long long int dp[1005], p[1005];
int main() {
  unsigned long long int i, n, sum = 0, j;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> p[i];
  }
  for (i = 1; i <= n; i++) {
    if (p[i] == i)
      dp[i] = 2;
    else {
      for (j = p[i]; j < i; j++) dp[i] = (dp[i] % mod + dp[j] % mod) % mod;
      dp[i] = (dp[i] % mod + 2 % mod) % mod;
    }
  }
  for (i = 1, sum = 0; i <= n; i++) {
    sum = (sum % mod + dp[i] % mod) % mod;
  }
  cout << sum << endl;
}
