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;
	int ans = 0;
	this(int id, int v){
		this.id = id;
		this.value = v;
		this.isLeader = false;
		}
	string toString(){
		return id.to!string ~ "(" ~ value.to!string ~ (isLeader? "*": "") ~ ")";
		}
	}

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