#include <bits/stdc++.h>
using namespace std;
struct ASDF {
  ASDF& operator,(int& a) {
    scanf("%d", &a);
    return *this;
  }
  ASDF& operator,(long int& a) {
    scanf("%ld", &a);
    return *this;
  }
  ASDF& operator,(long long int& a) {
    scanf("%lld", &a);
    return *this;
  }
  ASDF& operator,(char& c) {
    scanf("%c", &c);
    return *this;
  }
  ASDF& operator,(double& d) {
    scanf("%lf", &d);
    return *this;
  }
  template <typename T>
  ASDF& operator,(T& a) {
    cin >> a;
    return *this;
  }
} asdf;
template <typename T>
ostream& operator<<(ostream& output, vector<T>& v) {
  output << "[ ";
  if (int(v.size())) {
    output << v[0];
  }
  for (int i = 1; i < int(v.size()); i++) {
    output << ", " << v[i];
  }
  output << " ]";
  return output;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& output, pair<T1, T2>& p) {
  output << "( " << p.first << ", " << p.second << " )";
  return output;
}
long long firstVisit[1005];
int p[1005];
long long simulate(int n) {
  memset(firstVisit, 0, sizeof(firstVisit));
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    firstVisit[i] = cnt;
    cnt =
        (cnt + 2 + firstVisit[i] + 1000000007 - firstVisit[p[i]]) % 1000000007;
  }
  return cnt;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  cout << simulate(n) << endl;
}
