local function comp(a, b)
  return a < b
end

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if not comp(ary[1], x) then return 1 end
  if comp(ary[num], x) then return num + 1 end
  local min, max = 1, num
  while 1 < max - min do
    local mid = (min + max) // 2
    if comp(ary[mid], x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n = io.read("*n")
local stage = {1}
local stagenum = {io.read("*n")}
local stagesum = {stagenum[1]}
local stageaddcnt = {1}
for i = 2, n do
  local a = io.read("*n")
  local pos = lower_bound(stagenum, a)
  if #stagenum < pos then
    table.insert(stage, i)
    table.insert(stagenum, a)
    table.insert(stagesum, a)
    table.insert(stageaddcnt, 1)
  else
    stagesum[pos] = stagesum[pos] + a
    stageaddcnt[pos] = stageaddcnt[pos] + 1
  end
end
local ret = {}
for i = 1, n do
  ret[i] = 0
end

for i = #stagesum, 2, -1 do
  local dst_i = stage[i]
  local num = stagenum[i]
  local sum = stagesum[i]
  local addcnt = stageaddcnt[i]
  ret[dst_i] = sum - addcnt * stagenum[i - 1]
  stageaddcnt[i - 1] = stageaddcnt[i - 1] + addcnt
  stagesum[i - 1] = stagesum[i- 1] + stagenum[i - 1] * addcnt
end
ret[1] = stagesum[1]

print(table.concat(ret, "\n"))
