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