#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100010;
int a[N],n;
ll f[N];
int q[N],head,tail,g[N];
int l,r,mid;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	head = tail = 0;
	q[1] = 1; q[0] = 0;
	for(int i=1;i<=n;i++){
		if(a[q[tail]]>=a[i]){
			l = head, r = tail;
			while(l<r){
				mid = (l+r)>>1;
				if(a[q[mid]]>=a[i]) r = mid; else l = mid+1;	
			}
			g[l]++;
			f[q[l]]-=a[q[l]]-a[i];
		} else{
			q[++tail] = i;
			g[tail] = 1;
		}
	}
	for(int i = tail;i>0;i--){
		f[q[i]]+=1ll*(a[q[i]]-a[q[i-1]])*g[i];
		g[i-1]+=g[i];
	}
	for(int i=1;i<=n;i++) printf("%lld\n",f[i]);
	return 0;
}