#include <bits/stdc++.h>
using namespace std;
const int N = 1005001;
int n, p[1010], dp[1010];
signed main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  dp[1] = 2;
  for (int i = 2; i <= n; i++) {
    for (int j = p[i]; j < i; j++) dp[i] += dp[j], dp[i] %= 1000000007;
    dp[i] += 2;
    dp[i] %= 1000000007;
  }
  for (int i = 1; i < n; i++) dp[n] += dp[i], dp[n] %= 1000000007;
  cout << dp[n] << endl;
}
