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