#include <bits/stdc++.h>
#define ll long long 
using namespace std;
const int n = 2e5 + 5;
ll a[n];
ll fr[n];
int main()
{
ll n;
cin>>n;

ll ans=0;
for(int i=0;i<n;i++){
cin>>a[i];
ans+=fr[a[i]];
fr[a[i]]++;

}
for(int i=0;i<n;i++){
cout<<ans-(fr[a[i]]-1)<<endl;
}

  
  // your code goes here
	return 0;
}
