// Slower C++ solution:
#include<bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef pair<int, int> PII;



const int MM = 1e9 + 7;

const double eps = 1e-8;

const int MAXN = 2e6 + 10;



int n, m;



void prework(){



}



void read(){



}



class BITree{

public:

    static const int SIZE = 100010, BIAS = 5;

    long long u[SIZE];

    void clear(){

        memset(u,0,sizeof(u));

    }

    void modify(int x, long long v){

        for(x+=BIAS;x<SIZE;x+=x&-x) u[x]+=v;

    }

    long long getsum(int x){

        long long s=0;

        for(x+=BIAS;x;x-=x&-x) s+=u[x];

        return s;

    }

} hnk;



int a[MAXN];

int f[MAXN];

ll g[MAXN];



void solve(int casi){

	scanf("%d", &n);

	map<int, int> nico;

	for(int i = 1; i <= n; i++){

		scanf("%d", &a[i]);

		nico[a[i]] = 1;

	}

	int cnt = 0;

	for(auto &x : nico){

		x.second = ++cnt;

	}

	

//	for(auto &x : nico){

//		cout<<x.first<<' '<<x.second<<endl;

//	}

	

	hnk.clear();

	for(int i = 1; i <= n; i++){

		hnk.modify(1, 1);

		hnk.modify(nico[a[i]] + 1, -1);

	}

	cnt = 0;

	for(auto &x : nico){

		++cnt;

		f[cnt] = x.first;

		g[cnt] = hnk.getsum(x.second);

	}

	f[0] = 0;

	/*

	for(int i = 1; i <= cnt; i++){

		cout<<f[i]<<' ';

	} cout<<endl;

	for(int i = 1; i <= cnt; i++){

		cout<<g[i]<<' ';

	} cout<<endl;

	*/for(int i = 1, j = 1; i <= n; i++){

		ll ans = 0;

		while(j <= cnt && a[i] >= f[j]){

			ans += g[j] * (f[j] - f[j-1]);

			j++;

		}

		printf("%lld\n", ans);

	}

}



void printans(){



}





int main(){

	prework();

	int T = 1;

//	cin>>T;

	for(int i = 1; i <= T; i++){

		read();

		solve(i);

		printans();

	}

	return 0;

}






// Faster C++ solution for the same problem (measured speedup: 1.7770074451964843x):
/*input

10

1 2 1 3 2 4 2 5 8 1

*/



#include <iostream>

#include <vector>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <string>

#include <cassert>

#include <algorithm>

#include <cstdlib>

#include <numeric>

#include <utility>

#include <tuple>

#include <climits>

#include <fstream>

#include <bitset>

#include <map>

#include <unordered_map>

#include <set>

#include <unordered_set>

#include <stack>

#include <queue>

#include <random>

#include <chrono>

#include <ios>

#include <iomanip>

#include <functional>

#include <array>



using namespace std;



#define FOR(i, a, b) for (int i = a; i <= b; ++i)

#define FORA(i, a) for (auto &i : a)

#define FORB(i, a, b) for (int i = a; i >= b; --i)

#define SZ(a) ((int) a.size())

#define ALL(a) begin(a), end(a)



typedef int64_t ll;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

typedef vector<int> vi;

typedef vector<ll> vl;

#define fi first

#define se second



// start of code



int32_t main()

{

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);



	int N;

	cin >> N;

	vector<pii> vec(N + 1);

	vec[0] = pii(0, 0);

	FOR(i, 1, N) {

		cin >> vec[i].fi;

		vec[i].se = i;

	}



	sort(ALL(vec));

	vl ans(N + 1);

	FOR(i, 1, N) {

		ans[vec[i].se] = (ll) (vec[i].fi - vec[i - 1].fi) * (N - i + 1);

	}



	int curMin = N + 1;

	FORB(i, N, 1) {

		curMin = min(curMin, vec[i].se);

		if (curMin != vec[i].se) {

			ans[curMin] += ans[vec[i].se];

			ans[vec[i].se] = 0;

		}

	}

	FOR(i, 1, N) cout << ans[i] << '\n';

	return 0;

}