#include <bits/stdc++.h>
using namespace std;
long long int fast_exp(long long int A, long long int B, long long int C) {
  if (A == 0) return 0;
  if (C == 0) return 0;
  if (B == 0) return 1;
  if (B == 1) return A % C;
  long long int res = A;
  if (res > C) res = res % C;
  int counter = 2;
  while (counter < B) {
    res = res * res;
    if (res > C) res = res % C;
    counter *= 2;
    if (counter >= B) break;
  }
  counter /= 2;
  return ((res % C) * fast_exp(A, B - counter, C)) % C;
}
long long int mod_add(long long int a, long long int b, long long int m) {
  return (a + b) % m;
}
long long int subtract(long long int a, long long int b, long long int m) {
  return ((a - b) % m + m) % m;
}
long long int multiply(long long int a, long long int b, long long int m) {
  return (a * b) % m;
}
long long int divide(long long int a, long long int b, long long int m) {
  return (a * fast_exp(b, m - 2, m)) % m;
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> p;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    p.push_back(x);
  };
  long long int mod = 1000000007LL;
  vector<long long int> dp(n, 0);
  dp[0] = 2;
  for (long long int i = 1; i < n; i += 1) {
    dp[i] += 2;
    dp[i] %= mod;
    for (long long int j = p[i] - 1; j < i; j += 1) {
      dp[i] += dp[j];
      dp[i] %= mod;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i += 1) {
    ans += dp[i];
    ans %= mod;
  }
  cout << ans << "\n";
  return 0;
}
