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