import bisect

import heapq

import itertools

import math

import operator

import os

import re

import string

import sys

from collections import Counter, deque, defaultdict

from copy import deepcopy

from decimal import Decimal

from fractions import gcd

from functools import lru_cache, reduce

from operator import itemgetter, mul, add, xor



import numpy as np



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(2147483647)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7





class BinaryIndexedTree:

    # http://hos.ac/slides/20140319_bit.pdf

    def __init__(self, size):

        """

        :param int size:

        """

        self._bit = [0] * size

        self._size = size



    def add(self, i, w):

        """

        i 番目に w を加える

        :param int i:

        :param int w:

        :return:

        """

        x = i + 1

        while x <= self._size:

            self._bit[x - 1] += w

            x += x & -x



    def sum(self, i):

        """

        0 番目から i 番目までの合計

        :param int i:

        :return:

        """

        ret = 0

        x = i + 1

        while x > 0:

            ret += self._bit[x - 1]

            x -= x & -x

        return ret



    def __len__(self):

        return self._size





N = int(sys.stdin.readline())

A = list(map(int, sys.stdin.readline().split()))

A = np.array(A, dtype=int)

ans = np.zeros(N, dtype=int)



# for i in range(N):

#     if A[i] <= 0:

#         continue

#     ans[i] = np.minimum(A, A[i]).sum()

#     A = np.maximum(0, A - A[i])

# print(ans)



counts = Counter(A)

counts[0] = 0

counts[IINF] = 0

keys = list(sorted(counts.keys()))



ki = 0

cnt = 0

s = 0

for i in range(N):

    if A[i] - s <= 0:

        continue

    m = A[i]

    # s 以上 m 以下のやつの合計

    p = s

    while keys[ki] <= m:

        ans[i] += (keys[ki] - p) * (N - cnt)

        p = keys[ki]

        cnt += counts[keys[ki]]

        ki += 1



    s = A[i]



print(*ans, sep='\n')

# [10  7  0  4  0  3  0  2  3  0]

import os

import sys



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(2147483647)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7



N = int(sys.stdin.readline())

A = list(map(int, sys.stdin.readline().split()))



XY = [(a, i) for i, a in enumerate(A)]

XY.sort(reverse=True)



# 解説

ans = [0] * N

min_y = IINF

for i, (x, y) in enumerate(XY):

    min_y = min(min_y, y)

    x2 = XY[i + 1][0] if i + 1 < N else 0

    ans[min_y] += (x - x2) * (i + 1)

print(*ans, sep='\n')

import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor
import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7


class BinaryIndexedTree:
    # http://hos.ac/slides/20140319_bit.pdf
    def __init__(self, size):
        """
        :param int size:
        """
        self._bit = [0] * size
        self._size = size

    def add(self, i, w):
        """
        i 番目に w を加える
        :param int i:
        :param int w:
        :return:
        """
        x = i + 1
        while x <= self._size:
            self._bit[x - 1] += w
            x += x & -x

    def sum(self, i):
        """
        0 番目から i 番目までの合計
        :param int i:
        :return:
        """
        ret = 0
        x = i + 1
        while x > 0:
            ret += self._bit[x - 1]
            x -= x & -x
        return ret

    def __len__(self):
        return self._size


N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
A = np.array(A, dtype=int)
ans = np.zeros(N, dtype=int)
# for i in range(N):
#     if A[i] <= 0:
#         continue
#     ans[i] = np.minimum(A, A[i]).sum()
#     A = np.maximum(0, A - A[i])
# print(ans)
counts = Counter(A)
counts[0] = 0
counts[IINF] = 0
keys = list(sorted(counts.keys()))
ki = 0
cnt = 0
s = 0
for i in range(N):
    if A[i] - s <= 0:
        continue
    m = A[i]
    # s 以上 m 以下のやつの合計
    p = s
    while keys[ki] <= m:
        ans[i] += (keys[ki] - p) * (N - cnt)
        p = keys[ki]
        cnt += counts[keys[ki]]
        ki += 1
    s = A[i]
print(*ans, sep="\n")
# [10  7  0  4  0  3  0  2  3  0]

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
XY = [(a, i) for i, a in enumerate(A)]
XY.sort(reverse=True)
# 解説
ans = [0] * N
min_y = IINF
for i, (x, y) in enumerate(XY):
    min_y = min(min_y, y)
    x2 = XY[i + 1][0] if i + 1 < N else 0
    ans[min_y] += (x - x2) * (i + 1)
print(*ans, sep="\n")

-import bisect -import heapq -import itertools -import math -import operator -import re -import string -from collections import Counter, deque, defaultdict -from copy import deepcopy -from decimal import Decimal -from fractions import gcd -from functools import lru_cache, reduce -from operator import itemgetter, mul, add, xor -import numpy as np - - -class BinaryIndexedTree: -    # http://hos.ac/slides/20140319_bit.pdf -    def __init__(self, size): -        """ -        :param int size: -        """ -        self._bit = [0] * size -        self._size = size - -    def add(self, i, w): -        """ -        i 番目に w を加える -        :param int i: -        :param int w: -        :return: -        """ -        x = i + 1 -        while x <= self._size: -            self._bit[x - 1] += w -            x += x & -x - -    def sum(self, i): -        """ -        0 番目から i 番目までの合計 -        :param int i: -        :return: -        """ -        ret = 0 -        x = i + 1 -        while x > 0: -            ret += self._bit[x - 1] -            x -= x & -x -        return ret - -    def __len__(self): -        return self._size - - -A = np.array(A, dtype=int) -ans = np.zeros(N, dtype=int) -# for i in range(N): -#     if A[i] <= 0: -#         continue -#     ans[i] = np.minimum(A, A[i]).sum() -#     A = np.maximum(0, A - A[i]) -# print(ans) -counts = Counter(A) -counts[0] = 0 -counts[IINF] = 0 -keys = list(sorted(counts.keys())) -ki = 0 -cnt = 0 -s = 0 -for i in range(N): -    if A[i] - s <= 0: -        continue -    m = A[i] -    # s 以上 m 以下のやつの合計 -    p = s -    while keys[ki] <= m: -        ans[i] += (keys[ki] - p) * (N - cnt) -        p = keys[ki] -        cnt += counts[keys[ki]] -        ki += 1 -    s = A[i] +XY = [(a, i) for i, a in enumerate(A)] +XY.sort(reverse=True) +# 解説 +ans = [0] * N +min_y = IINF +for i, (x, y) in enumerate(XY): +    min_y = min(min_y, y) +    x2 = XY[i + 1][0] if i + 1 < N else 0 +    ans[min_y] += (x - x2) * (i + 1) -# [10  7  0  4  0  3  0  2  3  0]