#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void PLAY() {
  cout << fixed << setprecision(10);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MOD = 1e9 + 7;
int main() {
  PLAY();
  int n, a[1005], dp[1005] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  int res = 0;
  for (int i = 0; i < n; i++) {
    dp[i] = 2;
    for (int j = a[i]; j < i; j++) dp[i] = (dp[i] + dp[j]) % MOD;
    res = (res + dp[i]) % MOD;
  }
  cout << res << endl;
  return 0;
}
