#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e3 + 5, oo = 1e9 + 7;
long long n, p;
long long f[maxN];
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%I64d\n", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &p);
    f[i + 1] = (2 * f[i] + 2 - f[p] + oo) % oo;
  }
  printf("%I64d", f[n + 1]);
  return 0;
}
