#include <bits/stdc++.h>
using namespace std;
long long n, arr[1001], dp[1001], sum = 1;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  dp[1] = 1;
  for (int i = 2; i <= n; i++, sum = (sum + 1) % 1000000007)
    if (arr[i] == i)
      dp[i] = 1, sum = (sum + 1) % 1000000007;
    else {
      for (int j = arr[i]; j < i; j++) dp[i] += dp[j], dp[i] %= 1000000007;
      dp[i] += i - arr[i] + 1, dp[i] %= 1000000007;
      sum += dp[i], sum %= 1000000007;
    }
  cout << (sum + 1) % 1000000007 << "\n";
  return 0;
}
