#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const int mod = 1000000007;
int n;
long long sum[MAXN], p[MAXN], num[MAXN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) {
    num[i] = (sum[i - 1] - sum[p[i] - 1] + 2 + mod) % mod;
    sum[i] = (sum[i - 1] + num[i] + mod) % mod;
  }
  cout << sum[n] << endl;
  return 0;
}
