#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr ll INF = 1e18;

int main() {
    int N;
    cin >> N;
    map<ll, set<ll>> m;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        m[-a].insert(i);
    }
    m[0].insert(-1);

    ll cnt = 0;
    vector<ll> res(N);
    ll mi = INF;
    for(auto it = m.begin(); it != m.end(); ++it) {
        if(it->first == 0) {
            break;
        }
        cnt += it->second.size();
        mi = min(mi, *(it->second.begin()));
        ll next = std::next(it)->first;
        res[mi] += cnt * (next - it->first);
    }

    for(auto x : res) {
        cout << x << endl;
    }
}
