#include <bits/stdc++.h>
using namespace std;
int quick_pow(int a, int b, int MOD) {
  a %= MOD;
  int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    b /= 2;
    a = (a * a) % MOD;
  }
  return res;
}
const int maxn = 200000 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int a[maxn], dp[maxn];
priority_queue<int, vector<int>, greater<int> > que1, que2[maxn];
typedef struct Segment {
  int sum[maxn * 4];
  void pushUp(int k) { sum[k] = min(sum[k * 2], sum[k * 2 + 1]); }
  void build(int k, int l, int r) {
    sum[k] = INF;
    if (l == r) return;
    int m = (l + r) / 2;
    build(k * 2, l, m);
    build(k * 2 + 1, m + 1, r);
  }
  void update(int p, int v, int k, int l, int r) {
    if (l == r) {
      sum[k] = min(sum[k], v);
      return;
    }
    int m = (l + r) / 2;
    if (p <= m)
      update(p, v, k * 2, l, m);
    else
      update(p, v, k * 2 + 1, m + 1, r);
    pushUp(k);
  }
  int ask(int a, int b, int k, int l, int r) {
    if (a <= l && r <= b) return sum[k];
    int m = (l + r) / 2, res = INF;
    if (a <= m) res = min(res, ask(a, b, k * 2, l, m));
    if (b > m) res = min(res, ask(a, b, k * 2 + 1, m + 1, r));
    return res;
  }
} Tree;
Tree tree;
int main() {
  int i, j, n, m;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  tree.build(1, 1, n);
  printf("0");
  int now = 0;
  tree.update(a[1], a[1] + 1, 1, 1, n);
  now = -1;
  for (i = 2; i <= n; i++) {
    int res = now + i;
    res = min(res, tree.ask(i, n, 1, 1, n) - i);
    printf(" %d", res);
    tree.update(a[i], res + 1 + a[i], 1, 1, n);
    now = min(now, res - i);
  }
  puts("");
  return 0;
}
