#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<long long>A(N);
  vector<long long>B(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    B.at(A.at(i)-1)=B.at(A.at(i)-1)+1;
  }
  long long sum=0;
  for(int i=0;i<N;i++){
    sum=sum+(B.at(i)*(B.at(i)-1))/2;
  }
  for(int i=0;i<N;i++){
    cout<<sum-(B.at(A.at(i)-1)-1)<<endl;
  }
}