/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#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 <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using graph = vector<vector<int>>;
using wgraph = vector<vector<pair<int, long long int>>>;
long long int INF = 1001001001001001LL;
int inf = 100100100;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(int i = s; i < t; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

// quoted from beet-aizu
template <typename T, typename E, typename F, typename G>
struct SegmentTree{
    // using F = function<T(T, T)>
    // using G = function<T(T, E)>
    int n;
    F f;
    G g;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,G g,T ti):f(f),g(g),ti(ti){}
    void init(int n_){    
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,ti);
    }
    void build(const vector<T> &v){
        int n_=v.size();
        init(n_);
        for(int i=0;i<n_;i++) dat[n+i]=v[i];
        for(int i=n-1;i;i--)
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void update(int k,const E &x){
        k += n;
        dat[k] = g(dat[k], x);
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
    }
    T operator [](int k) const { return dat[k+n]; }
    T query(int a,int b) const {
        T vl=ti,vr=ti;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
            if(l&1) vl=f(vl,dat[l++]);
            if(r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }

    
    
    /* TODO わからない 聞く 
    template<typename C>
    int find(int a,int b,C &check,int k,int l,int r){
        if(!check(dat[k])||r<=a||b<=l) return -1;
        if(k>=n) return k-n;
        int m=(l+r)>>1;
        int vl=find(a,b,check,(k<<1)|0,l,m);
        if(~vl) return vl;
        return find(a,b,check,(k<<1)|1,m,r);
    }
    template<typename C>
    int find(int a,int b,C &check){
        return find(a,b,check,1,0,n);
    }*/
    
};


int main(){
  using T = pair<lint, lint>;  // type T
  using E = lint;  // type E
  auto f = [](T a, T b){ // return type T value
    if(a.first > b.first) return a;
    else if(a.first < b.first) return b;
    else {
      if(a.second < b.second) return a;
      else return b;
    }
  };
  auto g = [](T a, E b){ // return type T value
    return a;
  };
  T ti = {0, INF};  // identify element
  SegmentTree<T, E, decltype(f), decltype(g)> sg(f, g, ti);  // don't change

  lint n; cin >> n;
  vector<lint> a(n);
  vector<pair<lint, lint>> dat(n);
  rep(i, n) {
    cin >> a[i];
    dat[i] = {a[i], i};
  }

  sg.build(dat);   // 初期配列を代入

  lint r = n;
  lint l = 0;
  vector<pair<lint, lint>> cols;
  while(l < r) {
    pair<lint, lint> val = sg.query(l, r);
    cols.push_back(val);
    r = val.second; 
  }
  
  using RST = lint;
  using RSE = lint;
  auto RSf = [](RST a, RST b) {
    return a + b;
  };
  auto RSg = [](RST a, RSE b) {
    return b;
  };
  RST RSti = 0;
  SegmentTree<RST, RSE, decltype(RSf), decltype(RSg)> rs(RSf, RSg, RSti);  // don't change
  rs.build(vector<RST> (n, RSti));

  vector<lint> ans(n, 0);
  sort(rall(dat));
  dat.pb({-1, -1});
  lint datId = 0;
  lint cnt = 0;
  lint preSum = 0;
  for(int i = 0; i < cols.size(); i++) {
    lint val = cols[i].first;
    lint id = cols[i].second;
    
    // val 以上のやつ全部セグ木につっこも
    while(dat[datId].first >= val) {
      rs.update(dat[datId].second, dat[datId].first);
      datId++;
      cnt++;
    }

    if(i == 0) continue;

    lint sum = rs.query(id, n);
    sum -= cnt * val;
    lint preId = cols[i - 1].second;
    ans[preId] = sum - preSum;
    preSum = sum;
  }
  
  ans[0] = accumulate(a.begin(), a.end(), 0LL) - accumulate(ans.begin(), ans.end(), 0LL);
  for(auto hoge : ans) cout << hoge << endl;

  return 0;
}


Measured memory_bytes: 14192