"use strict";
function main(input) {
  const n = parseInt(input[0]);
  const b = input[1].trim().split(" ").map(i => parseInt(i));

  let a = JSON.parse(JSON.stringify(b));

  a.sort(function(a, b) {
    return a - b;
  });

  let list = new Object();

  let result = 0;
  for(let i=0;i<n;i++){
    let counter = 0;
    while(true){
      if(counter+i >= n){
        i+counter+2;
        break;
      }else if(a[i+counter+1] === a[i]){
        counter++;
      }else{
        break;
      }
    }
    list[""+a[i]] = new Object();
    if(counter===0){
      list[""+a[i]].before = 0;
      list[""+a[i]].normal = 0;
    }else if(counter==1){
      list[""+a[i]].before = 0;
      list[""+a[i]].normal = 1;
    }else{
      list[""+a[i]].before = Math.floor((counter)*(counter-1)/2);
      list[""+a[i]].normal = Math.floor((counter+1)*counter/2);
    }
    i += counter;
    result += list[""+a[i]].normal;
    //console.log(result)
  }
  //console.log(list)

  for(let i=0;i<n;i++){
    console.log(result - (list[""+b[i]].normal - list[""+b[i]].before));
  }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));