'use strict';

const inputs = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');

const input2 = inputs[1].split(' ').map(v => parseInt(v, 10));

const a = {};

input2.forEach(v => pushA(v));


const b = {};

Object.keys(a).forEach((v) => {
  Object.keys(a).forEach((v2) => {
    if (v == v2) {
      pushB(v, funcB(a[v2] - 1));
    } else {
      pushB(v, funcB(a[v2]));
    }
  });
});

input2.forEach((v) => {
  console.log(b[v]);
});

function pushA(value) {
  if (a[value]) {
    ++a[value]
  } else {
    a[value] = 1;
  }
}

function pushB(i, value) {
  if (b[i]) {
    b[i] += value;
  } else {
    b[i] = value;
  }
}

function funcB(value) {
  return ((value + 1) * value / 2) - value;
}