// Slower C++ solution:
#include <iostream>

#include <iomanip>

#include <cstdio>

#include <string>

#include <cstring>

#include <deque>

#include <list>

#include <queue>

#include <stack>

#include <vector>

#include <utility>

#include <algorithm>

#include <map>

#include <set>

#include <complex>

#include <cmath>

#include <limits>

#include <cfloat>

#include <climits>

#include <ctime>

#include <cassert>

using namespace std;



#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)

#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)

#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)

#define all(v) begin(v), end(v)

#define pb(a) push_back(a)

#define fr first

#define sc second

#define INF 2000000000

#define int long long int



#define X real()

#define Y imag()

#define EPS (1e-10)

#define EQ(a,b) (abs((a) - (b)) < EPS)

#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )

#define LE(n, m) ((n) < (m) + EPS)

#define LEQ(n, m) ((n) <= (m) + EPS)

#define GE(n, m) ((n) + EPS > (m))

#define GEQ(n, m) ((n) + EPS >= (m))



typedef vector<int> VI;

typedef vector<VI> MAT;

typedef pair<int, int> pii;

typedef long long ll;



typedef complex<double> P;

typedef pair<P, P> L;

typedef pair<P, double> C;



int dy[]={0, 0, 1, -1};

int dx[]={1, -1, 0, 0};

int const MOD = 1000000007;



namespace std {

    bool operator<(const P& a, const P& b) {

        return a.X != b.X ? a.X < b.X : a.Y < b.Y;

    }

}



signed main() {

    int n; cin >> n;

    pii a[100010];

    int v[100010];

    int cnt[100010] = {};

    map<int, int> m, m2;

    int idx = 0;

    rep(i,0,n) v[i] = INF;

    rep(i,0,n) {

        int inp;

        cin >> inp;

        a[i] = pii(inp, i);

    }

    sort(a, a+n);

    rep(i,0,n) {

        if(!m2.count(a[i].fr)) {

            v[idx] = min(v[idx], a[i].sc);

            cnt[idx]++;

            m[idx] = a[i].fr;

            m2[ a[i].fr ] = idx++;

        }

        else {

            v[ m2[a[i].fr] ] = min(v[ m2[a[i].fr] ], a[i].sc);

            cnt[ m2[a[i].fr] ]++;

        }

    }

    int ans[100010] = {};

    idx--;

    while(idx != -1) {

        int mi = v[idx], sz = cnt[idx];

        // printf("idx = %lld, val = %lld, mi = %lld, sz = %lld\n", idx, m[idx], mi, sz);

        int sum, diff;

        if(idx != 0) {

            diff = m[idx] - m[idx-1];

            sum = sz * diff;

        }

        else {

            diff = m[idx];

            sum = sz * diff;

        }

        ans[mi] += sum;



        if(idx != 0) {

            v[idx-1] = min(v[idx-1], v[idx]);

            cnt[idx-1] += cnt[idx];

        }

        idx--;

    }

    rep(i,0,n) {

        cout << ans[i] << endl;

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.264154740239864x):
// 基本テンプレート



#include <iostream>

#include <iomanip>

#include <cstdio>

#include <string>

#include <cstring>

#include <deque>

#include <list>

#include <queue>

#include <stack>

#include <vector>

#include <utility>

#include <algorithm>

#include <map>

#include <set>

#include <complex>

#include <cmath>

#include <limits>

#include <cfloat>

#include <climits>

#include <ctime>

#include <cassert>

#include <numeric>

#include <fstream>

#include <functional>

using namespace std;



#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)

#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)

#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)

#define int long long int



template<typename T> void chmax(T &a, T b) {a = max(a, b);}

template<typename T> void chmin(T &a, T b) {a = min(a, b);}

template<typename T> void chadd(T &a, T b) {a = a + b;}



typedef pair<int, int> pii;

typedef long long ll;



int dx[] = {0, 0, 1, -1};

int dy[] = {1, -1, 0, 0};

constexpr ll INF = 1001001001001001LL;

constexpr ll MOD = 1000000007LL;



int N;

int ans[100010];



signed main() {

    cin >> N;

    vector<pii> v;

    v.push_back(pii(0, 0));

    rep(i,0,N) {

        int p; cin >> p;

        v.push_back(make_pair(p, -i));

    }



    sort(v.begin(), v.end(), greater<pii>());

    int idx = 0, c = INF;

    while(v[idx].first != 0) {

        chmin(c, -v[idx].second);



        int ub = N, lb = idx;

        while(ub - lb > 1) {

            int mid = (ub + lb) / 2;

            if(v[mid].first != v[idx].first) ub = mid;

            else lb = mid;

        }



        int diff = v[idx].first - v[ub].first;

        ans[c] += ub * diff;

        idx = ub;

    }



    rep(i,0,N) cout << ans[i] << endl;

    return 0;

}