#include<cstdio>
long long n,a[200005],v[200005],ans;
int main(){
	scanf("%lld",&n);
	for(long long i=1;i<=n;++i)
		scanf("%lld",&a[i]),++v[a[i]];
	for(long long i=1;i<=n;++i)
		ans+=(v[i]*(v[i]-1))>>1;
	for(long long i=1;i<=n;++i)
		printf("%lld\n",ans-v[a[i]]+1);
	return 0;
} 