#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i], p[i]--;
  vector<long long> ans(n);
  ans[0] = 2;
  for (int i = 1; i < n; i++) {
    long long cur = 0;
    for (int j = p[i]; j < i; j++) cur += ans[j], cur %= MOD;
    ans[i] = cur + 2;
  }
  long long a = 0;
  for (long long i : ans) a += i, a %= MOD;
  cout << a << '\n';
  return 0;
}
