#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long sum = 0;
  vector<int>cnt(n+1,0);
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i];
    cnt[data[i]]++;
    sum += cnt[data[i]]-1;
  }
  for(int i = 0;i < n;i++){
    cout << sum-(cnt[data[i]]-1) << endl;
  }
}
