#include <bits/stdc++.h>
using namespace std;
const int M = (int)(1e9 + 7);
int p[1005];
int dp[1005];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
  }
  dp[1] = 0;
  for (int i = 1; i <= n; ++i) {
    dp[i + 1] = dp[i] + 1 + dp[i] - dp[p[i]] + 1;
    dp[i + 1] %= M;
    if (dp[i + 1] < 0) dp[i + 1] += M;
  }
  cout << dp[n + 1];
  return 0;
}
