#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return (a + b);
  if (a > b) return (gcd(a % b, b));
  return (gcd(b, b % a));
}
using namespace std;
int n, m;
int p[1009 + 1], dp[1009 + 1];
int main() {
  cin >> n;
  for (int i = (int)(1); i < (int)(n + 1); ++i) cin >> p[i];
  dp[1] = 2;
  for (int i = (int)(2); i < (int)(n + 1); ++i) {
    dp[i] = 2;
    for (int j = (int)(p[i]); j < (int)(i); ++j)
      dp[i] += dp[j], dp[i] %= 1000000007;
  }
  long long v = 0;
  for (int i = (int)(1); i < (int)(n + 1); ++i) v += dp[i], v %= 1000000007;
  cout << v << endl;
  return 0;
}
