/*
 
@author
_      _          _                 _      _
\\    // /\    | | \  |     |    /\ \\    //     
 \\  // /__\   | |_/  |_____|   /__\ \\  //
  \\// /    \  | | \  |     |  /    \ \\//
   \/ /      \ | |_/  |     | /      \ \/
@ Indian Institute of Technology Bhilai
*/
 
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
#define fr(i,start,end, inc) for(ll i=(start); i<(end); i+=inc)
#define rf(i,end,start, inc) for(ll i=(start-1); i>=(end); i-=inc)
#define rep(i,n) for(ll i=0; i<n; i++)
#define rep1(i,n) for(ll i=1; i<n; i++)
#define pb push_back
#define pl pair<ll, ll>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define alla(arr,n) arr, arr+n
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define fsync ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll maxx =  1e9+7;


bool compare(const pl &a, const pl &b){
    return a.fi<b.fi || (a.fi==b.fi && a.se<b.se);
}
ll inline power(ll a, ll b, ll p){
    a %= p;
    ll ans = 1;
    while(b>0){
        if(b & 1)
            ans = (ans*a)%p;
        a = (a*a)%p;
        b >>= 1;
    }
    return ans;
}

ll inv(ll n, ll p){
    return power(n,p-2, p);
}
inline vector<ll> allinv(ll n, ll p){
    vector<ll> arr(n);
    arr[1]=1;
    fr(i,2,n,1){
        arr[i] = (p - (p/i)*arr[p%i]%p)%p;
    }
    return arr;
}
vector<ll> inline allncr(ll n, ll p){
    vector<ll> nci(n+1);
    nci[0]=1;
    nci[n]=1;
    vector<ll> v = allinv(n,p);
    fr(i,1,n,1){
        nci[i]=(nci[i-1]*(n-i-1))%p;
    }
    return nci;
}

bool inline isPrime(ll n) { 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
    return true; 
}

template<class T>
void printv(T &v){
    ll n = v.size();
    rep(i,n)
        cout << v[i] << " ";
    cout << "\n";
}
//------------fenwick--------------
/*vector<ll> f(maxn,0);
void fenwick_update(ll idx, ll val){
    while(idx <= maxn){
        f[idx]+=val;
        idx += (idx & -idx);
    }
}
ll read_fenwick(ll idx){
    ll sum = 0;
    while(idx > 0){
        sum += f[idx];
        idx -= (idx & -idx);
    }
    return sum;
}*/


ll longestPrefixSuffix(string s) { 
    ll n = s.length(); 
    ll lps[n]; 
    lps[0] = 0; 
    ll len = 0, i=1;
    while (i < n){ 
        if (s[i] == s[len]){ 
            len++; 
            lps[i] = len; 
            i++; 
        } 
        else{ 
            if (len != 0) 
                len = lps[len-1]; 
            else
                lps[i] = 0,i++;
        } 
    } 
    ll res = lps[n-1]; 
    return (res > n/2)? n/2 : res; 
} 

bool pal(string x){
    string a = x;
    reverse(all(a));
    return a==x;
}
void solve(){
    string s;
    cin >> s;
    ll n = s.length();
    string x = s.substr(0,n/2);
    string y = s.substr(n/2+1);
    if(pal(x) && pal(y) && pal(s))
        yes;
    else
        no;       
}
void solve2(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    map<ll,ll> m;
    rep(i,n){
        cin >> v[i];
        m[v[i]]++;
    }
    ll ans = 0;
    for(auto &y:m){
        ans += (y.se*(y.se-1))/2;
    }
    rep(i,n){
        ll x = v[i];
        if(m[x]>=2){
            cout << ans - (m[x]-1)<<"\n";
        }
        else
            cout << ans << "\n";
    }
}

int main(){
    fsync
    ll test=1;
    // cin >> test;
    while(test--){
        solve2();

    }
}

Measured memory_bytes: 11136