/+ dub.sdl:
    name "A"
    dependency "dcomp" version=">=0.6.0"
+/

import std.stdio, std.range, std.algorithm, std.conv;
// import dcomp.scanner;
// import dcomp.algorithm;
// import dcomp.container.simpleseg;

int main() {
    auto sc = new Scanner(stdin);
    int n;
    long[] a;
    sc.read(n, a);
    long ma = 0;
    long[] div = new long[n];
    foreach (i, d; a) {
        div[i] = ma;
        ma = max(ma, d);
    }
    long[] v = a.dup.sort!"a<b".uniq.array;
    int getI(long x) {
        return binSearch!(i => v[i]>=x)(-1, v.length.to!int);
    }
    auto coSeg = SimpleSeg!(long, (a,b)=>(a+b), 0L)(n);
    auto smSeg = SimpleSeg!(long, (a,b)=>(a+b), 0L)(n);
    long[] res = new long[n];
    foreach_reverse(i, d; a) {
        coSeg[getI(d)] = coSeg[getI(d)]+1;
        smSeg[getI(d)] = smSeg[getI(d)]+d;
        res[i] = smSeg.sum(getI(div[i]), n);
        res[i] -= coSeg.sum(getI(div[i]), n) * div[i];
    }
    res ~= 0;
    writeln(iota(n).map!(i => res[i]-res[i+1]).map!(to!string).join("\n"));
    return 0;
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

class Scanner {
    import std.stdio : File;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    File f;
    this(File f) {
        this.f = f;
    }
    string[] buf;
    private bool succ() {
        while (!buf.length) {
            if (f.eof) return false;
            buf = f.readln.split;
        }
        return true;
    }
    private bool readSingle(T)(ref T x) {
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                //string or char[10] etc
                x = buf.front;
                buf.popFront;
            } else {
                static if (isStaticArray!T) {
                    //static
                    assert(buf.length == T.length);
                }
                x = buf.map!(to!E).array;
                buf.length = 0;                
            }
        } else {
            x = buf.front.to!T;
            buf.popFront;            
        }
        return true;
    }
    int read(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
}

unittest {
    import std.path : buildPath;
    import std.file : tempDir;
    import std.algorithm : equal;
    import std.stdio : File;
    string fileName = buildPath(tempDir, "kyuridenanmaida.txt");
    auto fout = File(fileName, "w");
    fout.writeln("1 2 3");
    fout.writeln("ab cde");
    fout.writeln("1.0 1.0 2.0");
    fout.close;
    Scanner sc = new Scanner(File(fileName, "r"));
    int a;
    int[2] b;
    char[2] c;
    string d;
    double e;
    double[] f;
    sc.read(a, b, c, d, e, f);
    assert(a == 1);
    assert(equal(b[], [2, 3]));
    assert(equal(c[], "ab"));
    assert(equal(d, "cde"));
    assert(e == 1.0);
    assert(equal(f, [1.0, 2.0]));
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/algorithm.d */
// module dcomp.algorithm;

import std.range.primitives;
import std.traits : isFloatingPoint, isIntegral;

//[0,0,0,...,1,1,1]で、初めて1となる場所を探す。pred(l) == 0, pred(r) == 1と仮定
T binSearch(alias pred, T)(T l, T r) if (isIntegral!T) {
    while (r-l > 1) {
        T md = (l+r)/2;
        if (!pred(md)) l = md;
        else r = md;
    }
    return r;
}

T binSearch(alias pred, T)(T l, T r, int cnt = 60) if (isFloatingPoint!T) {
    foreach (i; 0..cnt) {
        T md = (l+r)/2;
        if (!pred(md)) l = md;
        else r = md;
    }
    return r;
}

Rotator!Range rotator(Range)(Range r) {
    return Rotator!Range(r);
}

struct Rotator(Range)
if (isForwardRange!Range && hasLength!Range) {
    size_t cnt;
    Range start, now;
    this(Range r) {
        cnt = 0;
        start = r.save;
        now = r.save;
    }
    this(this) {
        start = start.save;
        now = now.save;
    }
    @property bool empty() {
        return now.empty;
    }
    @property auto front() {
        assert(!now.empty);
        import std.range : take, chain;
        return chain(now, start.take(cnt));
    }
    @property Rotator!Range save() {
        return this;
    }
    void popFront() {
        cnt++;
        now.popFront;
    }
}


E minimum(alias pred = "a < b", Range, E = ElementType!Range)(Range range, E seed)
if (isInputRange!Range && !isInfinite!Range) {
    import std.algorithm, std.functional;
    return reduce!((a, b) => binaryFun!pred(a, b) ? a : b)(seed, range);
}

ElementType!Range minimum(alias pred = "a < b", Range)(Range range) {
    assert(!range.empty, "range must not empty");
    auto e = range.front; range.popFront;
    return minimum!pred(range, e);
}

E maximum(alias pred = "a < b", Range, E = ElementType!Range)(Range range, E seed)
if (isInputRange!Range && !isInfinite!Range) {
    import std.algorithm, std.functional;
    return reduce!((a, b) => binaryFun!pred(a, b) ? b : a)(seed, range);
}

ElementType!Range maximum(alias pred = "a < b", Range)(Range range) {
    assert(!range.empty, "range must not empty");
    auto e = range.front; range.popFront;
    return maximum!pred(range, e);
}

unittest {
    assert(minimum([2, 1, 3]) == 1);
    assert(minimum!"a > b"([2, 1, 3]) == 3);
    assert(minimum([2, 1, 3], -1) == -1);
    assert(minimum!"a > b"([2, 1, 3], 100) == 100);

    assert(maximum([2, 1, 3]) == 3);
    assert(maximum!"a > b"([2, 1, 3]) == 1);
    assert(maximum([2, 1, 3], 100) == 100);
    assert(maximum!"a > b"([2, 1, 3], -1) == -1);
}

bool[ElementType!Range] toMap(Range)(Range r) {
    import std.algorithm : each;
    bool[ElementType!Range] res;
    r.each!(a => res[a] = true);
    return res;
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/container/simpleseg.d */
// module dcomp.container.simpleseg;

// simpleなsegtree
// a op b op .. op x が求められる、遅延評価なし
// (T, op)はモノイドの必要がある、eはモノイド
struct SimpleSeg(T, alias op, T e) {
    const size_t n, sz;
    T[] d;
    @disable this();
    this(size_t n) {
        import std.algorithm : fill;
        import core.bitop : bsr;
        int lg = n.bsr;
        if ((2^^lg) < n) lg++;
        this.n = n;
        this.sz = 2^^lg;
        d = new T[](2*this.sz);
        d.fill(e);
    }
    T opIndex(int idx) {return d[idx+sz];}
    void opIndexAssign(T v, int idx) {
        import std.stdio : writeln;
        idx += sz;
        d[idx] = v;
        while (idx/2 >= 1) {
            idx /= 2;
            d[idx] = op(d[2*idx], d[2*idx+1]);
        }
    }
    //todo more beautiful?
    T sum(size_t a, size_t b, size_t l, size_t r, size_t k) {
        if (b <= l || r <= a) return e;
        if (a <= l && r <= b) return d[k];
        size_t md = (l+r)/2;
        return op(sum(a, b, l, md, 2*k),
            sum(a, b, md, r, 2*k+1));
    }
    //[a, b)
    T sum(size_t a, size_t b) {
        return sum(a, b, 0, sz, 1);
    }
    //todo formatspec?
    string toString() {
        import std.conv : to;
        return d[sz..sz+n].to!string;
    }
}


Measured memory_bytes: 13244