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