#include <bits/stdc++.h>
int dp1[1010], dp2[1010];
int p[1010];
int main() {
  int n;
  dp1[1] = 0;
  dp2[1] = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &p[i]);
  for (int i = 2; i <= n + 1; ++i) {
    dp1[i] = (dp2[i - 1] + 1) % 1000000007;
    dp2[i] = (2 * dp1[i] - dp1[p[i]] + 1) % 1000000007;
    while (dp2[i] < 0) dp2[i] += 1000000007;
  }
  printf("%d ", dp1[n + 1]);
  return 0;
}
