#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e3 + 10;
const int mod = 1e9 + 7;
int n;
int p[maxn];
long long dp[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  dp[1] = 0;
  for (int i = 1; i <= n; i++) {
    dp[i + 1] = (2 * dp[i] - dp[p[i]] + 2 + mod) % mod;
  }
  printf("%lld\n", (dp[n + 1] + mod) % mod);
  return 0;
}
