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