#include <bits/stdc++.h>
int main() {
  unsigned long long dp[1000 + 1];
  int goback[1000 + 1];
  int n, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &goback[i]);
  dp[0] = 0;
  dp[1] = 2;
  for (i = 2; i <= n; i++)
    dp[i] = ((2 + dp[i - 1] + 1000000007 - dp[goback[i] - 1]) % 1000000007 +
             dp[i - 1]) %
            1000000007;
  printf("%I64d\n", dp[n]);
  return 0;
}
