#include <bits/stdc++.h>
using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

typedef pair<int, int> P;
#define X first
#define Y second
const int N = 100005;
int a[N];
ll ans[N];

struct SegmentTree {
	vector<int> mx, ps;
	SegmentTree(int n) {
		int tn = 1;
        while (tn <= n) tn = tn << 1;
        tn <<= 1;
        mx.resize(tn);
        ps.resize(tn);
	}
	void build_tree(int ind, int s, int e) {
        if (e - s == 1) {
            mx[ind] = a[s];
            ps[ind] = s;
            return;
        }
        int c1 = ind << 1, c2 = c1 | 1, m = (s + e) >> 1;
        build_tree(c1, s, m);
        build_tree(c2, m, e);
        if (mx[c1] >= mx[c2]) {
        	mx[ind] = mx[c1], ps[ind] = ps[c1];
        }
        else {
        	mx[ind] = mx[c2], ps[ind] = ps[c2];
        }
    }

    void update(int ind, int s, int e, int idx, int val) {
        if (s > idx || e <= idx) return;
        int c1 = ind << 1, c2 = c1 | 1, m = (s + e) >> 1;
        if (e - s == 1) {
            mx[ind] = val;
            return;
        }
        update(c1, s, m, idx, val);
        update(c2, m, e, idx, val);
        if (mx[c1] >= mx[c2]) {
        	mx[ind] = mx[c1], ps[ind] = ps[c1];
        }
        else {
        	mx[ind] = mx[c2], ps[ind] = ps[c2];
        }
    }

    /* interval [s, e) */
    P query(int ind, int s, int e, int ss, int ee) {
        if (s >= ee || e <= ss) return P(-1, -1);
        if (s >= ss && e <= ee) return P(mx[ind], -ps[ind]);
        int c1 = ind << 1, c2 = c1 | 1, m = (s + e) >> 1;
        P vl = query(c1, s, m, ss, ee);
        P vr = query(c2, m, e, ss, ee);
        return max(vl, vr);
    }
};

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n; cin >> n;
	ll sum = 0;
	REPU(i, 0, n) {
		cin >> a[i]; sum += a[i];
	}
	SegmentTree st(n);
	st.build_tree(1, 0, n);
	int to = n;
	int bad = 0, maxi = INT_MAX >> 1;
	while (true) {
		P p = st.query(1, 0, n, 0, to);
		int idx = -p.Y;
		if (idx == 0) {
			ans[0] += sum;
			break;
		}
		to = idx;
		P q = st.query(1, 0, n, 0, idx);
		ll g = bad * 1LL * (maxi - q.X);
		ans[idx] += g, sum -= g, maxi = q.X;
		while (true) {
			P rs = st.query(1, 0, n, idx, n);
			if (rs.X <= q.X) break;
			int d = rs.X - q.X;
			sum -= d, ans[idx] += d, bad++;
			st.update(1, 0, n, -rs.Y, -1);
		}
	}
	REPU(i, 0, n) {
		printf("%lld\n", ans[i]);
	}

	return 0;
}


Measured memory_bytes: 4352