/*		     ___
			(._.)
			<|>         HELLO IT'S ME! KINGSLEY ZHONG!
			_/\_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          ___   ____
        /' --;^/ ,-_\     \ | /
       / / --o\ o-\ \\   --(_)--
      /-/-/|o|-|\-\\|\\   / | \
       '`  ` |-|   `` '
             |-|
             |-|O                    2020 @ CodeForces, CodeChef, CCC & More!
             |-(\,__
          ...|-|\--,\_....
      ,;;;;;;;;;;;;;;;;;;;;;;;;,.
~~,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,  ______   ---------   _____     ------
 */


//Optimisation
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")\
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


//Imports
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <queue>
#include <vector>

using namespace std;

//Macros
#define el '\n'
#define elc << el;
#define debug(x) cout << ">>" << x << el;
#define rep(i, c) for(ll i = 0; i <(c); ++i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define max(x,y) (x>y)?x:y
#define min(x,y) (x<y)?x:y
#define mid(s,e) (s+(e-s)/2)
#define absv(a) (a<0)?(-1*a):a
#define negv(a) (a>0)?(-1*a):a
#define arrset(a,b,v) rep(i, b) a[i]=v //Sets array to a value, where a is the array, b is the count, and v is the value

//Typedefs
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;

//Random Stuff
#define Pi 3.141592653589793
#define space << ' ' <<
const ll mod = 1000000007;

//Functions
inline int twop(int n) { return 1 << n; }
template<class T> T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<class T> T lcm(T a, T b ){return (a*b)/gcd(a,b);}

//Testcase start
#define tcs() int testcases; cin >> testcases; while(testcases--)

int main() {
	//Fast io for cin / cout
	ios_base::sync_with_stdio(false);
	cin.tie(0); //Comment out if there is large exchange of cin / cout
	cout.tie(0);

	//USE FOR TESTCASE PROBLEMS
	ll n;
	cin >> n;

	ll val[n];
	ll big = 0;
	rep (a, n){
		cin >> val[a];
		if(val[a] > big)
			big = val[a];
	}

	/*bool act[big+1] = {false};
	int prec[big+1] = {0};


	rep(a, n){
		if(act[val[a]]){
			cout << prec[val[a]] elc;
			continue;
		}
		ll count[big+1] = {0}; //no 0 shift
		rep(b , n){
			if(b != a){
				count[val[b]]++;
			}
		}
		ll sum = 0;
		for(const auto& c: count){
			sum += (c*(c-1)/2);
		}
		act[val[a]]= true;
		prec[val[a]] = sum;

		cout << sum << el;
	}*/
	bool act[big+1] = {false};
	ll prec[big+1] = {0};
	ll count[big+1]={0};

	rep(a, n){
		count[val[a]]++;
	}

	ll ac = 0;
	ll presum = 0;
	for(const auto& c: count){
		presum += (c*(c-1)/2);
		++ac;
	}



	rep(k, n){
		if(act[val[k]]){
			cout << prec[val[k]] elc;
		}
		else{//if this is too slow do dp
			//count[val[k]]--;
			ll sum = 0;

			ll valk = count[val[k]];

			sum = presum-(valk*(valk-1)/2)+((valk-1)*(valk-2)/2);

			act[val[k]]= true;
			prec[val[k]] = sum;

			cout << sum << el;
//			count[val[k]]++;
		}


	}




	return 0;
}


Measured memory_bytes: 7424