#include <bits/stdc++.h>
using namespace std;
int n;
int p[1010];
int dp[1010];
const int mod = 1000000007;
int solve(int k) {
  if (k == 0) return 2;
  if (dp[k] >= 0) return dp[k];
  int tmp = 2;
  for (int i = p[k]; i < k; i++) tmp = (tmp + solve(i)) % mod;
  dp[k] = tmp;
  return tmp;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) p[i]--;
  for (int i = 0; i < n; i++) dp[i] = -1;
  int res = 0;
  for (int i = 0; i < n; i++) res = (res + solve(i)) % mod;
  cout << res << endl;
  return 0;
}
