// Problem : D - Banned K
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using mapl = map < ll , ll >;
using mapc = map < char , ll >;
using vectorl = vector < ll >;
using vectors = vector < string >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define pb push_back
#define endl "\n"
const ll mod = 1000000007;

ll i=0,j=0,k=0,t=0,n=0;

char x='a',y='a',z='a';
string s="",s1="";

vectorl pr;
void seive(int n){ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++){ 
        if (prime[p] == true){ 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for (int p=2; p<=n; p++) 
      if (prime[p]) 
          pr.push_back(p);
} 

double log_base(ll x, ll base) {
    return ((log(x)*1.0) / (log(base)*1.0));
}


ll power_without_mod(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1){
            ans=ans*a;
        }
        a = a * a;
        b >>= 1;
    }
    return ans;
}

ll power(ll a,ll b){
	a%=mod;
	ll ans=1;
	while(b>0){
		if(b&1){
			ans=ans*a%mod;
		}
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}
// if mod is prime: calculate x^(n mod (m-1))
// if  is string   find number calculating with mod of (m-1)

//for ex:
// string b = "100000000000000000000000000"; 
  
//     ll remainderB = 0; 
//     ll MOD = 1000000007; 
  
//     // Reduce the number B to a small number 
//     // using Fermat Little 
//     for (int i = 0; i < b.length(); i++) 
//         remainderB = (remainderB * 10 + b[i] - '0') % (MOD - 1); 
  
//     cout << power(a, remainderB, MOD) << endl; 

// Returns factorial of n 
// ll fact(ll n,ll dp2[]) 
// { 
    // // ll res = 1; 
    // // for (ll i = 2; i <= n; i++) 
        // // res = res * i; 
    // return dp2[n-1]*n; 
// } 
// 
// ll nCr(ll n, ll r) 
// { 
    // return 
// } 
  


void solve(){
	ll n;
	cin>>n;
	ll a[n];
	map<ll,ll> mp;
	vectorl v;
	ll dp2[n+1];
	memset(dp2,0,sizeof(dp2));
	dp2[0]=1;
	// for(i=1;i<=n;i++){
		// dp2[i]=dp2[i-1]*i;
	// }
	for(i=0;i<n;i++){
		cin>>a[i];
		mp[a[i]]++;
		if(mp[a[i]]==1)
			v.push_back(a[i]);
	}
	ll s=v.size();
	map<ll,pll> mp2;
	// ll dp[s+1][2];
	// memset(dp,-1,sizeof(dp));
	for(i=0;i<v.size();i++){
		ll q=0,w=0;
		if(mp[v[i]]>=2){
		q=(mp[v[i]]*(mp[v[i]]-1)) / 2; 
		// dp[i][0]=nCr(mp[v[i]],2);
		if(mp[v[i]]>=3)
		w=((mp[v[i]]-1)*(mp[v[i]]-2)) / 2;
		// else
		// w=0;
		}
		// dp[i][1]=nCr(mp[v[i]]-1,2);
		// else{
			// q=0;
		// w=0;
		// }
		// cout<<q<<" "<<w<<endl;
		mp2[v[i]]={q,w};
		
		// cout<<v[]<<" "<<dp[]
	}
	ll sum1=0,sum2=0;
	for(i=0;i<v.size();i++){
		sum1+=mp2[v[i]].first;
	}
	// cout<<sum1<<endl;
	// for(i=0;i<v.size();i++){
		// sum2+=dp[i][1];
	// }
	for(i=0;i<n;i++){
		ll ans=sum1+mp2[a[i]].second-mp2[a[i]].first;
		// for(j=0;j<v.size();j++){
			// if(v[j]==a[i]){
				// ans+=dp[j][1];
				// // cout<<dp[j][1]<<" ";
			// }
			// else{
				// ans+=dp[j][0];
				// // cout<<dp[j][0]<<" ";			
			// }
		// }
		cout<<ans<<endl;
	}
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // ll t;
    // cin>>t;
    // while(t--){
    	solve();
    // }
    return 0;
}





Measured memory_bytes: 21492