#include <bits/stdc++.h>
using namespace std;
const int NUM_ROW = 109;
const int NUM_COL = 109;
const int MAX_INT = 2147483647;
struct pairT {
  long long a;
  long long b;
};
int mod(int a) {
  if (a < 0) {
    return -a;
  }
  return a;
}
int cmp(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
void printGrid(int grid[NUM_ROW][NUM_COL], int row_length, int col_length) {
  for (int i = 0; i < row_length; i++) {
    for (int j = 0; j < col_length; j++) {
      cout << grid[i][j] << " ";
    }
    cout << endl;
  }
}
void printArr(int *arr, int length) {
  for (int i = 0; i < length; i++) {
    cout << arr[i] << " ";
  }
  cout << endl;
}
void copyArr(int *arr, int *arr1, int length) {
  for (int i = 0; i < length; i++) {
    arr[i] = arr1[i];
  }
}
void copyGrid(int grid1[NUM_ROW][NUM_COL], int grid[NUM_ROW][NUM_COL],
              int row_length, int col_length) {
  for (int i = 0; i < row_length; i++) {
    for (int j = 0; j < col_length; j++) {
      grid1[i][j] = grid[i][j];
    }
  }
}
long long minimum(long long a, long long b) {
  if (a < b) {
    return a;
  }
  return b;
}
long long maximum(long long a, long long b) {
  if (a > b) {
    return a;
  }
  return b;
}
pairT getP(int a) {
  pairT p;
  p.a = -1;
  p.b = -1;
  int k = a * a;
  for (int i = 1; i < a; i++) {
    for (int j = 1; j < a; j++) {
      if ((i * i + j * j) == k) {
        p.a = minimum(i, j);
        p.b = maximum(i, j);
      }
    }
  }
  return p;
}
int usg(int a, int b) {
  int res = 1;
  for (int i = 2; i <= minimum(a, b); i++) {
    if (a % i == 0 && b % i == 0) {
      res = i;
    }
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  int arr[1009];
  arr[0] = 2;
  int y;
  cin >> y;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    long long sum = 2;
    for (int j = p; j < i; j++) {
      sum += arr[j];
    }
    sum = sum % 1000000007;
    arr[i] = sum;
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    res += arr[i];
  }
  res = res % 1000000007;
  cout << res << endl;
}
