#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, dp[10005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<long long> arr(n + 5);
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    dp[i] = 2;
    for (int j = arr[i]; j < i; ++j) {
      dp[i] = (dp[i] % mod + dp[j] % mod) % mod;
    }
    ans = (ans % mod + dp[i] % mod) % mod;
  }
  cout << ans << '\n';
}
