#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
const long long MAX = 1e3 + 50;
long long n, x, k, m, ans, a, b;
string second;
bool ok;
vector<long long> v;
long long BLOCK_SIZE;
vector<pair<pair<long long, long long>, long long> > queries;
map<string, vector<string> > to;
long long dp[MAX];
long long p[MAX], pref[MAX];
inline char nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <typename T = int>
inline T nxt() {
  char c = nc();
  T x = 0;
  int first = 1;
  for (; c > '9' || c < '0'; c = nc())
    if (c == '-') first = -1;
  for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = nc())
    ;
  x *= first;
  return x;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  n = nxt();
  for (int i = 1; i <= n; i++) p[i] = nxt(), dp[i] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = (1 + i - p[i] + pref[i - 1] - pref[p[i] - 1] + MOD) % MOD;
    pref[i] = (pref[i - 1] + dp[i]) % MOD;
  }
  ans = 0;
  for (int i = 1; i <= n; i++) ans += (1 + dp[i]) % MOD, ans %= MOD;
  cout << ans << '\n';
  return 0;
}
