// 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.6959471973311x):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

#define ll long long int

#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >

//added two more functions to set

//(1)*(set.find_by_order(k))[kth element in the sorted set] 

//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;

typedef vector< ll > lvi;

typedef vector< vi > vvi;

typedef vector< lvi > lvvi;

typedef pair< int,int > ii;

typedef pair< ll,ll > lii;

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

#define pb push_back

#define all(c) (c).begin(),(c).end()

#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator

#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps

#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors

#define tc(t) int (t); cin>>(t);while((t)--)

#define ff first

#define ss second

#define mp make_pair

#define ld long double

#define ull unsigned long long int

#define mod 1000000007

int main()

{

	ios_base::sync_with_stdio(false);

    cin.tie(NULL);	

	ll n,a[200000];

	cin>>n;

	map<ll,lii> mp1;

	for(int i=0;i<n;i++)

	{

		cin>>a[i];

	}

	for(ll i=n-1;i>=0;i--)

	{

		mp1[a[i]].ff=i;

		mp1[a[i]].ss++;

	}

	ll pos=n;

	lvi ans(n+2,0);

	ll ct=0;

	mp1[0]={-1,0};

	for(auto it=mp1.crbegin();it!=mp1.crend();it++)

	{

		pos=min(pos,it->ss.ff);

		if(pos==-1) break;

		ct+=it->ss.ss;

		ll value=it->ff;

		it++;

		ll next=it->ff;

		ll dif=value-next;

		ans[pos]+=(dif*ct);

		it--;

	}

	for(int i=0;i<n;i++)

	{

		cout<<ans[i]<<endl;

	}

	return 0;

}