#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,a[1<<18],h[1<<18];
ll tot;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",a+i),h[a[i]]++;
	for(int i=1;i<=n;i++)tot+=1ll*h[i]*(h[i]-1)/2;
	for(int i=1;i<=n;i++)printf("%lld\n",tot-(h[a[i]]-1));
	return 0;
}