function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var N = parseInt(input[0],10);
  var vec_A = input[1].map(e => (parseInt(e, 10)));
  var eachNumCount = Array.from({length: N}, () => 0);
  var pairCount = Array.from({length: N}, () => 0);
  var sumPair, tmp;
  var ans = [];
  for (var i = 0; i < N; i++){
    eachNumCount[vec_A[i]-1] ++;
    pairCount[vec_A[i]-1] = (eachNumCount[vec_A[i]-1] * (eachNumCount[vec_A[i]-1] - 1) / 2)
  }
  sumPair = sum(pairCount);
  for (var i = 0; i < N; i++){
    tmp = eachNumCount[vec_A[i]-1]
    if (tmp === 0) ans.push(sumPair)
    else ans.push(sumPair - (tmp * (tmp - 1) / 2) + ((tmp - 1) * (tmp - 2) / 2));
  }
  console.log(ans.join('\n'));
}   

var sum  = function(arr) {
  var sum = 0;
  arr.forEach(function(elm) {
      sum += elm;
  });
  return sum;
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));