#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 1005;
bool vis[maxn];
int num[maxn], pre[maxn];
int main() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> pre[i];
    num[i] = 2;
    for (int j = pre[i]; j < i; ++j) num[i] = (num[i] + num[j]) % mod;
    ans = (ans + num[i]) % mod;
  }
  cout << ans << endl;
  return 0;
}
