// Slower C++ solution:
#include<bits/stdc++.h>

#define int ll

//{ PXH612

using namespace std;

#define ll long long

#define db double

#define pp pair<int,int>

#define x first

#define y second



#define false(x) if(!(x))

template<typename A,typename B>bool Min(A &a,B b){if(a<=b) return 0;a=b;return 1;}

template<typename A,typename B>bool Max(A &a,B b){if(a>=b) return 0;a=b;return 1;}

#define in ({ll x=0;int o=0,c=char(),t=0;for(;!isdigit(c)&&t<1000;c=getchar(),t++) o=c=='-';for(;isdigit(c);c=getchar()) x=x*10+c-'0';o?-x:x;})

#define inchar ({char c=getchar();while(c==' '||c=='\n') c=getchar();c;})



#define FOR(i,a,b) for(int i=a,ENDFOR=b;i<=ENDFOR;i++)

#define ROF(i,a,b) for(int i=b,ENDFOR=a;ENDFOR<=i;i--)

#define RR(x,a,b) {cout<<#x<<": ";FOR(_,a,b) cout<<x[_]<<" ";cout<<"\n";}

#define rr(x) " "<<#x<<'='<<(x)<<" "



#define VEC(i,a) for(auto&i:a)

#define pb push_back

#define vn(a) (int)a.size()-1



#define bit(x,i) ((x>>(i-1))&1ll)

#define on(x,i) (x|(1ll<<(i-1)))

#define off(x,i) (x&~(1ll<<(i-1)))

#define mu(x) (1ll<<x)

#define bitnum(x) __builtin_popcountll(x)



#define segg(a,b) (abs(a-b)+1)

#define midd(a,b) (a+(b-(a))/2)

#define mems(x,a) memset(x,a,sizeof x)

#define open(a) freopen(a,"r",stdin)

#define shut(b) freopen(b,"w",stdout)

//}/////////////////////////////////////////////////////}



const int N=1e5+5;

int n;

int a[N],ans[N];

vector<int> e[N],v;



int low(int x){return lower_bound(v.begin(),v.end(),x)-v.begin();}

main()

{

  // open("frequency.inp");

    n=in;

    FOR(i,1,n) a[i]=in;

    FOR(i,1,n) v.pb(a[i]);



    v.pb(0);



    sort(v.begin(),v.end());

    v.erase(unique(v.begin(),v.end()),v.end());

    FOR(i,1,n) e[low(a[i])].pb(i);



    int cnt=0,mn=INT_MAX;

   // cout<<rr(v[0]) rr(v[1]) "\n";

    ROF(i,1,vn(v)) if(e[i].size())

    {

        VEC(j,e[i]) Min(mn,j);

        cnt+=e[i].size();

        ans[mn]+=cnt*(v[i]-v[i-1]);

    }

    FOR(i,1,n) cout<<ans[i]<<"\n";

}


// Faster C++ solution for the same problem (measured speedup: 3.475556281409837x):
#include <bits/stdc++.h>

#define ll long long

#define maxn 100005

#define F first

#define S second

#define fi(i,a,b) for(int i=a; i<=b; i++)

#define fid(i,a,b) for(int i=a; i>=b; i--)

#define VanLoi "a"

#define gb(i, j) ((i >> j) & 1)

#define reset(x) memset(x, 0,sizeof(x))

#define pb push_back

#define mp make_pair

#define MOD 1000000007

#define pii pair<int, int>

#define Block 400



using namespace std;



int n, vt[maxn], dem[maxn], tg[maxn], mi = 1e9;

ll res[maxn], sl = 0;

pii a[maxn], e[maxn];



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0); cout.tie(0);

   // freopen(VanLoi".inp", "r", stdin);

   // freopen(VanLoi".out", "w", stdout);

    cin >> n;

    fi(i, 1, n) {

        cin >> e[i].F;

        e[i].S = i;

    }

    sort(e + 1, e + n + 1);

    int j = 0;

    fi(i, 1, n) {

        if (e[i].F != e[i - 1].F) j++;

        a[e[i].S].F = j;

        a[e[i].S].S = e[i].F;

    }

    fi(i, 1, n) {

        dem[a[i].F]++;

        if (vt[a[i].F] == 0) vt[a[i].F] = i;

    }

    fi(i, 1, n) tg[i] = a[i].F;

    sort(tg + 1, tg + n + 1);

    sl = dem[tg[n]];

    fid(i, n - 1, 0) if (tg[i] != tg[i + 1]) {

        int l = vt[tg[i + 1]], r = vt[tg[i]];

        mi = min(mi, l);

        res[mi] += 1ll * (a[l].S - a[r].S) * sl;

        sl += dem[tg[i]];

    }

    fi(i, 1, n) cout << res[i] << '\n';

    return 0;

}