#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define ull unsigned long long
#define si short int
#define ll long long int
#define ld long double
#define pb push_back
#define pii pair<int, int>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define piii pair<pair<int, int>, int>
#define all(vec) vec.begin(), vec.end()
#define piiii pair<pair<int, int>, pair<int, int>>
#define fr(a, from, c) for(int a=(from); (a)<(c); (a)++)

/*-----------------------------------------------------SegTree---------------------------------------------*/
/*int mxn11 = (int) (3e5 + 2);
vector<ll> t(4 * mxn11 + 1, 0);
vector<int> t2(4 * mxn11 + 1, -1);*/
/*void build(int v, int vl, int vr) {
    if (vl == vr) {
        t2[v] = arr[vl];
    } else {
        int tmp = (vl + vr) >> 1;
        build(2 * v, vl, tmp);
        build(2 * v + 1, tmp + 1, vr);
        t2[v] = max(t2[2 * v], t2[2 * v + 1]);
    }
}
int getmax(int v, int vl, int vr, int l, int r) {
    if (l > r) return 0;
    if (vl == l && vr == r) {
        return t2[v];
    }
    int tmp = (vl + vr) >> 1;
    ll a = getmax(2 * v, vl, tmp, l, min(tmp, r));
    ll b = getmax(2 * v + 1, tmp + 1, vr, max(tmp + 1, l), r);
    return max(a,b);
}
void updatemax(int v, int vl, int vr, int pos) {
    if (vl==vr) {
        t2[v]=-1;
        return;
    }
    int tmp = (vl + vr) >> 1;
    if(pos<=tmp)updatemax(2 * v, vl, tmp, pos);
    else updatemax(2 * v + 1, tmp + 1, vr, pos);
    t2[v] = max(t2[2*v],t2[2*v+1]);
}

int getsumm(int v, int vl, int vr, int l, int r) {
    if (l > r) return 0;
    if (vl == l && vr == r) {
        return t[v];
    }
    int tmp = (vl + vr) >> 1;
    ll a = getsumm(2 * v, vl, tmp, l, min(tmp, r));
    ll b = getsumm(2 * v + 1, tmp + 1, vr, max(tmp + 1, l), r);
    return a+b;
}

void update(int v, int vl, int vr, int pos) {
    if (vl==vr) {
        t[v]=1;
        return;
    }
    int tmp = (vl + vr) >> 1;
    if(pos<=tmp)update(2 * v, vl, tmp, pos);
    else update(2 * v + 1, tmp + 1, vr, pos);
    t[v] = t[2*v]+t[2*v+1];
}*/

/*-----------------------------------------------------SegTree---------------------------------------------*/
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

/*-----------------------------------------------------OperatorsOverloaded---------------------------------*/
template<typename T>
istream &operator>>(istream &o, vector<T> &arr) {
    for (int i = 0; i < arr.size(); i++) o >> arr[i];
    return o;
}

template<typename T>
ostream &operator<<(ostream &o, vector<T> &arr) {
    for (int i = 0; i < arr.size(); i++) o << arr[i] << " ";
    o << endl;
    return o;
}
/*-----------------------------------------------------OperatorsOverloaded---------------------------------*/
/*-----------------------------------------------------MATH------------------------------------------------*/
inline ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


inline ll gcdex(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll xx, yy;
    ll gc = gcdex(b, a % b, yy, xx);
    x = xx;
    y = yy - (a / b) * xx;
    return gc;
}

inline ll pwm(ll xx, ll pow, ll MD) {
    if (pow < 0) { pow = pow % (MD - 1) + MD - 1; }
    ll mlt = 1;
    while (pow) {
        if (pow & 1) {
            mlt *= xx;
            mlt %= MD;
        }
        xx *= xx;
        pow >>= 1;
        xx %= MD;
    }
    return mlt;
}

inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }

inline int64_t hilbertOrder(int x, int y, int pow, int rotate) {
    if (pow == 0) {
        return 0;
    }
    int hpow = 1 << (pow - 1);
    int seg = (x < hpow) ? (
            (y < hpow) ? 0 : 3
    ) : (
                      (y < hpow) ? 1 : 2
              );
    seg = (seg + rotate) & 3;
    const int rotateDelta[4] = {3, 0, 0, 1};
    int nx = x & (x ^ hpow), ny = y & (y ^ hpow);
    int nrot = (rotate + rotateDelta[seg]) & 3;
    int64_t subSquareSize = int64_t(1) << (2 * pow - 2);
    int64_t ans = seg * subSquareSize;
    int64_t add = hilbertOrder(nx, ny, pow - 1, nrot);
    ans += (seg == 1 || seg == 2) ? add : (subSquareSize - add - 1);
    return ans;
}

/*-----------------------------------------------------MATH------------------------------------------------*/
/*
int dp[3000][3000];
ll mod=998244353;
*/
int dp[1<<10][1001];
int arr[10][1001];
void solve(){
   /* int n,s;
    cin>>n>>s;
    vector<int> arr(n);
    cin>>arr;
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<s;j++){
            if(j<arr[i]){
                dp[i][j]=0;
            }
            else if(j==arr[i]){
                dp[i][j]=1;
            }
            else{
                ll summ = get(1,0, n-1, j-arr[i], i+1, n-1);
                dp[i][j]=summ;
            }
        }
    }*/
    /*int h,w, k;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=1;j<w+1;j++){
            arr[i][j]=s[j-1]-'0';
        }
    }
    for(int i=1;i<w+1;i++){
        for(int j=0;j<(1<<(h-1));j++){
            int l=-1;
            int r=i;
            while(r-l>1){
                int m=(l+r)>>1;
                int res=0;
                bool ok=true;
                for(int f=0;f<h;f++) {
                    if(f!=0 && (j>>(f-1))&1){
                        res=0;
                    }
                    for (int d = m + 1; d <= i; d++) {
                        res+=arr[f][d];
                    }
                    if(res>k) ok=false;
                }
                //if(i==w) cout<<res<<" "<<j<<" "<<m<<endl;
                if(ok) r=m;
                else l=m;
            }
            //if(i==w)cout<<l<<" "<<j<<endl;
            if(r==0) dp[j][i]= __builtin_popcount(j);
            else dp[j][i]= dp[j][r]+1;
        }
    }
    int mn=100000;
    for(int i=0;i<(1<<(h-1));i++){
        mn=min(dp[i][w], mn);
        //cout<<dp[i][w]<<" "<<i<<endl;
    }
    cout<<mn;*/
    int n;
    cin>>n;
    vector<int> arr(n);
    vector<ll> cnt(2e5+1,0);

    cin>>arr;
    for(int i=0;i<n;i++){
        cnt[arr[i]]++;
    }
    ll ans=0;
    for(int i=0;i<2e5+1;i++){
        ans+=(cnt[i]*(cnt[i]-1))/2;
    }
    for(int i=0;i<n;i++){
        ans-=(cnt[arr[i]]-1);
        cout<<ans<<" ";
        ans+=(cnt[arr[i]]-1);
    }

}

//60000000 900000000 900000000 900000000
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "r", stdin);
    // f=fopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w");
    //freopen("C:\\Users\\Maximus\\CLionProjects\\Codeforces\\BestTeam\\output.txt", "w", stdout);
    unsigned int beg_time = clock();
    //
    /*cout<<6*(int)1e7<<endl;
    for(int i=0;i<6*(int)1e7;i++) {
        cout<<(int)(rnd()%((int)(2e6+1)) - 1e6)<<endl;
    }*/
    int n = 1;
    for (int i = 0; i < n; i++) solve();
    unsigned int end_time = clock();
   /* cout << endl << endl << end_time - beg_time;
    cout<<sizeof(unsigned int);*/
    return 0;
}

Measured memory_bytes: 4992