#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void amax(X& x, const Y& y) {
  if (x < y) x = y;
}
template <class X, class Y>
void amin(X& x, const Y& y) {
  if (x > y) x = y;
}
const int INF = 1e9 + 10;
const long long INFL = 1e18 + 10;
const int MAX = 2e5 + 10;
int n;
int a[MAX], f[MAX];
void bfs() {
  fill(f + 1, f + n + 1, INF);
  f[1] = 0;
  queue<int> qe;
  qe.push(1);
  while (!qe.empty()) {
    int u = qe.front();
    qe.pop();
    vector<int> es = {-1, a[u] - u, 1};
    for (auto e : es) {
      int v = u + e;
      if (1 <= v && v <= n && f[v] == INF) {
        f[v] = f[u] + 1;
        qe.push(v);
      }
    }
  }
}
void process() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  bfs();
  for (int i = 1; i <= n; i++) cout << f[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  process();
}
