#include <bits/stdc++.h>
using namespace std;
long long arr[100007], tree[3 * 100007], lazy[3 * 100007];
void BuildTree(long long node, long long b, long long e) {
  if (b == e) {
    tree[node] = arr[b];
    return;
  }
  long long mid = (b + e) / 2;
  long long left = 2 * node, right = 2 * node + 1;
  BuildTree(left, b, mid);
  BuildTree(right, mid + 1, e);
  tree[node] = max(tree[left], tree[right]);
}
long long query(long long node, long long b, long long e, long long l,
                long long r) {
  if (b > r || b > e || e < l) {
    return INT_MIN;
  }
  if (lazy[node] != 0) {
    tree[node] += (e - b + 1) * lazy[node];
    if (b != e) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (b >= l && e <= r) {
    return tree[node];
  }
  long long mid = (b + e) / 2, left = node * 2, right = node * 2 + 1;
  long long lft = query(left, b, mid, l, r);
  long long rgt = query(right, mid + 1, e, l, r);
  return max(lft, rgt);
}
void updateRange(long long node, long long b, long long e, long long l,
                 long long r, long long value) {
  if (lazy[node] != 0) {
    tree[node] += (e - b + 1) * lazy[node];
    if (b != e) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (b > e || b > r || e < l) {
    return;
  }
  if (b >= l && e <= r) {
    tree[node] += (e - b + 1) * value;
    if (b != e) {
      lazy[node * 2] += value;
      lazy[node * 2 + 1] += value;
    }
    return;
  }
  long long mid = (b + e) / 2, left = node * 2, right = node * 2 + 1;
  updateRange(left, b, mid, l, r, value);
  updateRange(right, mid + 1, e, l, r, value);
  tree[node] = max(tree[left], tree[right]);
}
int main() {
  ios_base::sync_with_stdio(0);
  long long t, qu, q, p, a;
  long long val;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  BuildTree(1, 1, n);
  memset(lazy, 0, sizeof lazy);
  for (int i = 1; i <= n; i++) {
    int idx = i;
    updateRange(1, 1, n, idx, idx, -arr[idx]);
    long long left = query(1, 1, n, 1, idx - 1);
    long long right = query(1, 1, n, idx + 1, n);
    long long ans = max(left, right);
    cout << ans << endl;
    updateRange(1, 1, n, idx, idx, arr[idx]);
  }
  return 0;
}
