#include <bits/stdc++.h>
using namespace std;
const int INF = 1e7;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    v[i]--;
  }
  vector<int> ans(n + 10, INF);
  ans[0] = 0;
  for (int i = 0; i < n; i++) {
    ans[i + 1] = min(ans[i + 1], ans[i] + 1);
    if (v[i] > i) {
      if (ans[v[i]] > ans[i] + 1) {
        ans[v[i]] = ans[i] + 1;
        int j = v[i];
        while (ans[j - 1] > ans[j] + 1) {
          ans[j - 1] = ans[j] + 1;
          j--;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i];
    if (i == n - 1)
      cout << endl;
    else
      cout << " ";
  }
  return 0;
}
