#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-6;
int p[1005];
int sdp[1005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  for (int i = 1; i <= n; i++)
    sdp[i] = ((sdp[i - 1] + sdp[i - 1] - sdp[p[i] - 1] + 2) % ((int)(1e9 + 7)) +
              ((int)(1e9 + 7))) %
             ((int)(1e9 + 7));
  printf("%d\n", sdp[n]);
  return 0;
}
