#include <bits/stdc++.h>
using namespace std;
int n, to[1000 + 5];
long long f[1000 + 5];
void upd(int &x, int y) { x = (x + y) % 1000000007; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &to[i]);
  for (int i = 2; i <= n + 1; ++i)
    f[i] = (2 * f[i - 1] + 2 - f[to[i - 1]]) % 1000000007;
  printf("%lld\n", (f[n + 1] + 1000000007) % 1000000007);
  return 0;
}
