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