#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(long long n, int i) { return n & (1LL << i); }
inline long long setBit(long long n, int i) {
  return n | (1LL << i);
  ;
}
inline long long resetBit(long long n, int i) { return n & (~(1LL << i)); }
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
int a[1010];
long long dp[1010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    dp[i] = 2;
    for (int j = a[i]; j < i; ++j) {
      dp[i] += dp[j];
      dp[i] %= 1000000007;
    }
  }
  for (int i = 1; i <= n; ++i) {
    dp[i] += dp[i - 1];
    dp[i] %= 1000000007;
  }
  cout << dp[n];
  return 0;
}
