#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<long long>
#define vd vector<long double>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_lr(i, f, n) for (int i = f; i < (int)(n); i++)
#define sum(v) accumulate(v.begin(),v.end(),0)
#define sumll(v) accumulate(v.begin(),v.end(),0LL)
#define counte(v,arg) count(v.begin(),v.end(),arg)
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<int>)
using namespace std;

string replace_all(string &s, string from, string to) {
    ll pos = s.find(from);
    while(true){
        pos = s.find(from, pos);
        if(pos==-1) break;
        s.replace(pos, from.length(), to);
        pos += to.length();
    }
    return s;
}

int combination(int n, int r) {
    if(r < n) return 0;
    if(r*2 > n) r = n-r;
    int nume = 1;
    int deno = 1;
    rep_lr(i, 1, r+1) {
        nume *= (n-i+1);
        deno *= i;
    }
    return nume / deno;
}

int ceil(int nume, int deno){
    return (nume+deno-1)/deno;
}

template<typename T> 
void vinp(int n, T v){
    rep(i,n){
        cin >> v.at(i);
    }
}

template<typename T>
bool isParall(vector<T> v1, vector<T> v2){
    return v1.at(0)*v2.at(1) - v1.at(1)*v2.at(0) == 0;
}

template<typename T>
bool isRightangle(vector<T> v1, vector<T> v2){
    return v1.at(0)*v2.at(0) + v1.at(1)*v2.at(1) == 0;
}

void solve(){
    int a, b, c, d;
    cin>> a >> b;
    cin>> c >> d;
    cout << a*d - b*c << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}

#include <bits//stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// MACROS
#define int                     long long
#define pb                      push_back
#define MAX                     1e17
#define MIN                     -1e17
#define PI                      3.1415926535897932384626433832795
#define mod                     1000000007
#define eps                     1e-9
#define set(x)                  memset(x, 0, sizeof(x))
#define clr(x)                  memset(x, -1, sizeof(x))
#define ff                      first
#define ss                      second
#define rep(i,a,b)              for(int i=a;i<b;i++)
#define sz(x)                   x.size()
#define endl                    "\n"
#define deb(x)                  cout << #x << "=" << x << endl
#define deb2(x, y)              cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x)                  x.begin(), x.end()
#define lb(a,x)                 lower_bound(all(a),x)
#define ub(a,x)                 upper_bound(all(a),x)

typedef priority_queue<int>     maxHeap;
typedef priority_queue<int,     vector<int>, greater<int>> minHeap;
typedef pair<int, int>          pii;
typedef vector<int>             vi;
typedef vector<string>          vs;
typedef vector<pii>             vpii;
typedef vector<vi>              vvi;
typedef map<int, int>            mpii;
typedef set<int>                seti;
typedef multiset<int>           mseti;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
template<typename T, typename T1>T amax(T &a, T1 b) {if (b > a)a = b; return a;}
template<typename T, typename T1>T amin(T &a, T1 b) {if (b < a)a = b; return a;}
// typedef long int                ld;
// typedef unsigned long int       lu;
// typedef long long int           ll;
// typedef unsigned long long int  llu;


// cout << fixed << setprecision(9) <<
int mpow(int base, int exp);

const int T2 = 105; const int T3 = 1005; const int T4 = 10005; const int T5 = 100005;
const int N = 3e5 + 5;

int arr[N];


void solve() {
    int n;
    cin >> n;
    rep(i, 0, n) cin >> arr[i];
    pbds st;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        st.insert(arr[i]);
        int tmp = st.order_of_key(arr[i]) + 1;
        ans += st.size() - tmp;
    }
    cout << ans << endl;
    for (int i = 0; i < n - 1; i++) {
        ans -= arr[i] ;
        ans += n - arr[i] - 1;
        cout << ans << endl;
    }

}


/* TIPS
1. for interactive prob remove fastio and endl
2. for vector pass as reference
3.

*/



int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {

        // cout<<"Case #"<<i<<": ";

        solve();


    }
    return 0;
}

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

