#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int MOD = 1000000007;
long long p[MAXN], dp[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &p[i]);
  dp[1] = 0;
  for (int i = 2; i <= n + 1; i++)
    dp[i] = (2 * dp[i - 1] + 2 - dp[p[i - 1]] + MOD) % MOD;
  printf("%lld\n", dp[n + 1]);
  return 0;
}
