#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 3;
const long long MOD = 1000000007;
int p[maxn];
long long dp[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++)
    dp[i] = (((2 * dp[i - 1] + 2ll) + MOD) % MOD - dp[p[i] - 1] + MOD) % MOD;
  cout << dp[n] << endl;
  return 0;
}
