#include <bits/stdc++.h>
using namespace std;
const long long SZ = 1e3 + 7;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long long MOD = 998244353;
vector<long long> dp(SZ, -1);
vector<long long> a(SZ);
long long go(long long idx) {
  if (dp[idx] != -1) {
    return dp[idx];
  }
  if (idx == 1) {
    return dp[idx] = 2;
  }
  long long ans = 0;
  for (long long i = a[idx]; i < idx; i++) {
    ans += go(i);
    ans %= mod;
  }
  ans += 2;
  ans %= mod;
  return dp[idx] = ans;
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += go(i);
    ans %= mod;
  }
  cout << (ans % mod) << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
