import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

class Pile{
	int id;
	int value;
	bool isLeader;
	this(int id, int v){
		this.id = id;
		this.value = v;
		this.isLeader = false;
		}
	}

void main(){
	int n = readln.chomp.to!int;
	int[] as = readln.chomp.split.map!(to!int).array;
	
	Pile[] piles;
	int[int] valuecount;
	
	for(int i = 0; i < as.length; i ++){
		int a = as[i];
		Pile p = new Pile(i, a);
		piles ~= p;
		if(!(a in valuecount)){
			p.isLeader = true;
			valuecount[a] = 1;
			}
		else valuecount[a] += 1;
		}
	
	debug piles.map!(p => [p.id, p.value]).writeln;
	
	
	int[] ks = valuecount.keys.sort!("a>b")().array;
	int sum = 0;
	int[int] valuecountsum;
	int[int] steps;
	for(int i = 0; i < ks.length; i ++){
		sum += valuecount[ks[i]];
		valuecountsum[ks[i]] = sum;
		if(i < ks.length - 1) steps[ks[i]] = ks[i] - ks[i + 1];
		else steps[ks[i]] = ks[i];
		}
	
	debug ks.writeln;
	debug valuecountsum.writeln;
	debug steps.writeln;
	
	int[] ans = piles.map!(p => p.isLeader? valuecountsum[p.value] * steps[p.value]: 0).array;
	foreach(a; ans) a.writeln;
	
	debug ans.writeln;
	
	}