def calc(st: list) -> int:
    res = 0
    l = 0
    for h, v in reversed(st):
        res += (h - l) * v
        l = h

    return res


INF = 1 << 60
N = int(input())
H = list(map(int, input().split()))

st = [(INF, 0)]
for i, h in enumerate(H):
    v = 1 if i % 2 == 0 else 0  # 1=水色

    while st[-1][0] <= h:
        st.pop()
    st.append((h, v))

    res = calc(st)
    print(res)