#include <bits/stdc++.h>
using namespace std;
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int Set(int N, int pos) { return (N | (1 << pos)); }
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
long long dp[1003], n, P[1002];
const long long mod = 1e9 + 7;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> P[i];
  for (int i = 2; i <= n + 1; i++) {
    dp[i] = dp[i - 1] + 2 + (dp[i - 1] - dp[P[i - 1]]);
    dp[i] %= mod;
    dp[i] = (dp[i] + mod) % mod;
  }
  cout << dp[n + 1];
}
