///*
//正在播放《フリージア》
//1:21  ━━━━━━●─────   5:35
//   ?   ?   ??   ?   ?
//```````'`...```````''`````````````'````````````````'`.`''
//```````''..`';;'```''```'''''''''''''`````````````````'':
//.````''''':;;!!:````'````'''''''''''``````````````````'':
//``''''''':;;;;;'```'``````''```````````____________```'':
//`````````:;;!;'```````````'```````'```|   所以说   |'``'':
//```````'|$&$%:````````````'```````````|不要停下来啊|''''':
//````'''!$&&&|'```````````'''::''::''''/ （指AC）  |':'':::
//````'':|&&&$!'`````'''''''::.....`;!;'/_________|''``'::
//  ....'|&&@$!'........```:!;'....`:;:```````````````````'
//..````;$&&&$!:''``````'':|%%!::;|%$$!::::::::''::::::::::
//``````!&&@&&|:'````````':|$$$$$$$$$|:':::::::::::::::::::
//`````:%&@@@@@@@@&&&@@@@&&&&@@@@@@@&&&|::::::::':::::::::;
//`````.```':|$@@@@@@@@@@@@@@@@@@@@@@@@###@@&&$|;:::'::::::
//````````````';|$&@@@@@@@@@###@@@@@@########@@@@$!''''::::
//`````````..````:|%$@@@@@#########@#########@@@@&!''''::::
//`````````````````:|&########################@@@$;::::::::
//``````````````````:!$@########################@%;:::'::::
//``````````..``````':|&#######################@@&!''''''::
//''''::'''`.`''''''':|@#######################@@&|:'`.`';!
//:::::::::``'''''';%@######################@@##@@&!::'';;;
//::;::::::`.''''';%@@@@####################$%@##@@%;:'':;!
//:;;;;::::``':;%@@@#########################&%&##@@|:'';;!
//;;!;;;;;;'`::;%@#############################@@##@$!'';!!
//;;;;;;;;:``':::::;|$@############################@$!'`;!!
//::;;;;;;:'`'::::::;!$@#######################&&@$$$;``:;;
//`````````..````````'|@#####################$;!$$$&@@|''':
//'''''''''''''':'''''|@#########@&@##########@@####@@&%|!!
//''''''''':'''::'':''!&########&!|&@##########&&####&%|!||
//:::::'''::::::::::::!&########|:;|$@#########@&###&%||||!
//:::::::'''''':::::::!&#######@!:;!!$@########@$&##@%||||!
//
//                    だからよ...止まるじゃねえぞ
// */




#include <vector>
#include <algorithm>
#include <string>
#include<cstring>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <bitset>
#include <cassert>
#include <chrono>
#include <random>
#include <iomanip>
#include <unordered_set>
#include <ctime>
#include <chrono>
using namespace std;
// #define  ll long long
const int N =1e6+10;
#define PII pair<int , int > 
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pb push_back
#define sz(x) (int)(x).size()
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
int n , m ,t ;

#define __i __int128
//ll mod = 1e9+7;

string manacher(string s){
	if(s.size()<2)return s;
	string t ;t+='$';
	for(int i=0;i<s.size();i++)
		t +='#'+s[i];
	t+='@';
	int num = t.size();
	int p[num];
	int id =0 , mx= 0;
	int maxl = -1;
	int index =0;
	for(int j=1 ;j<num-1;j++){
		p[j] = mx>j?min(p[2*id-j],mx - j):1;
		while(t[j+p[j]]==t[j-p[j]])p[j]++;
		if(mx<p[j]+j){
			mx = p[j]+j;
			id = j;
		}
		if(maxl < p[j]+ 1){
			maxl = p[j]-1 ;
			index = j;
		}
	}
	int start = (index - maxl)/2;
	//cout <<start<<endl;
	return s.substr(start ,start+maxl);
	
}
int ar[200010];int br[100010];
vector<int >v[100010];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
cin >>n;
map<ll , ll > mp;
for(int i=1;i<=n;i++)cin >>ar[i] ,mp[ar[i]]++;
map<ll ,ll > mm ;
 ll sum =0 ;
for(auto it : mp )sum +=(it.second)*(it.second-1)/2;
for(int i=1 ;i<=n;i++){

	 cout<<sum - (mp[ar[i]] -1)<<endl;
}
    return 0;

}


Measured memory_bytes: 14464