#include <bits/stdc++.h>
using namespace std;
int d[200001], inf = (int)1e9, a[200001];
deque<pair<int, int> > q1, q2;
int main() {
  int n, i, x;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  d[1] = 0;
  q1.push_back({a[1], 1});
  q2.push_back({-1 * a[1], 1});
  for (i = 2; i <= n; i++) {
    while (!q1.empty()) {
      if (a[q1.front().second] < i)
        q1.pop_front();
      else
        break;
    }
    while (!q2.empty()) {
      if (a[q2.front().second] > i)
        q2.pop_front();
      else
        break;
    }
    d[i] = d[i - 1] + 1;
    if (!q1.empty()) d[i] = min(d[i], q1.front().first - i + 1);
    if (!q2.empty()) d[i] = min(d[i], q2.front().first + i + 1);
    while (!q1.empty() && d[i] + a[i] <= q1.back().first) q1.pop_back();
    q1.push_back({d[i] + a[i], i});
    while (!q2.empty() && d[i] - a[i] <= q2.back().first) q2.pop_back();
    q2.push_back({d[i] - a[i], i});
  }
  for (i = 1; i <= n; i++) cout << d[i] << " ";
  return 0;
}
