#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100010;
int n,a[N],rak[N];
ll ans[N];
int cmp(int aa,int bb){
	if(a[aa]==a[bb]) return aa>bb;
	return a[aa]>a[bb];
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=0;i<=n;i++) rak[i]=i;
	sort(rak,rak+n+1,cmp);
	int now,nxt=0;
	ll tot1=0,tot2=0;
	while(nxt<n){
		now=nxt;
		while(rak[nxt]>=rak[now]) tot1+=a[rak[nxt]],nxt++,tot2++;
		ans[rak[now]]+=tot1-tot2*a[rak[nxt]];
		tot1=tot2*a[rak[nxt]];
	}
	for(int i=1;i<=n;i++) printf("%lld\n",ans[i]);
	return 0;
}