#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num[1005];
  long long cnt[1005], sum[1005];
  long long ans;
  while (cin >> n) {
    memset(num, 0, sizeof(num));
    memset(cnt, 0, sizeof(cnt));
    memset(sum, 0, sizeof(sum));
    ans = 0;
    for (int i = 1; i <= n; i++) cin >> num[i];
    cnt[1] = 2;
    sum[1] = 2;
    ans = 2;
    for (int i = 2; i <= n; i++) {
      if (num[i] == i)
        cnt[i] = 2;
      else {
        cnt[i] = sum[i - 1] - sum[num[i] - 1] + 2;
      }
      ans += cnt[i];
      ans = (ans + 1000000007) % 1000000007;
      sum[i] = (sum[i - 1] + cnt[i] + 1000000007) % 1000000007;
    }
    cout << ans << endl;
  }
  return 0;
}
