#include<iostream>
int n, a[200021], b[200021]; long long f;
signed main() {
	scanf("%d", &n);
	for(int i = 1; i <= (n);i++) {
		scanf("%d", &a[i]);
		f += b[a[i]]++;
	}
	for(int i = 1; i <= (n);i++) printf("%lld\n", f - b[a[i]] + 1);
}