'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));

input2.forEach((v, i) => {
  let b = 0;

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

  console.log(b);
});

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

function funcB(value) {
  let result = 0;
  for (let i = 1; i <= value; ++i) {
    result += i;
  }
  return result - value;
}