"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/),
    cid = 0;

// number一個取得
// eslint-disable-next-line no-unused-vars
const next = () => +cin[cid++];

// 文字列一個取得
// eslint-disable-next-line no-unused-vars
const nextstr = () => cin[cid++];

// BigInteger一個取得
// eslint-disable-next-line no-unused-vars
const nextbig = () => BigInt(cin[cid++]);

// 長さnの配列として取得。aは文字列フラグ
// eslint-disable-next-line no-unused-vars
const nexts = (n, a) =>
    a ? cin.slice(cid, (cid += n)) : cin.slice(cid, (cid += n)).map((a) => +a);

// w個ずつを組にして長さhの配列。aは文字列フラグ。
// eslint-disable-next-line no-unused-vars
const nextm = (h, w, a) => {
    var r = [],
        i = 0;
    if (a) for (; i < h; i++) r.push(cin.slice(cid, (cid += w)));
    else for (; i < h; i++) r.push(cin.slice(cid, (cid += w)).map((a) => +a));
    return r;
};
// 多次元配列。v,a1,a2,a3 なら、3次元。[[値vで長さa3の配列]をa2個並べた配列]をa1個並べた配列。
// eslint-disable-next-line no-unused-vars
const xArray = (...args) => {
    var a = args,
        l = a.length,
        r = "Array(a[" + --l + "]).fill().map(x=>{return " + a[0] + ";})";
    while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")";
    return eval(r);
};
main();

function main() {
    let n = next();
    let a = nexts(n);

    let nums = new Map();
    for (let i = 0; i < n; i++) {
        let t = a[i];
        nums.set(t, 1 + (nums.has(t) ? nums.get(t) : 0));
    }
    //console.log("nums:", nums);
    //console.log(nums);
    let C = new Map();
    let sum = 0;
    for (let key of nums.keys()) {
        sum += (nums.get(key) * (nums.get(key) - 1)) / 2;
    }
    //console.log("sum", sum);
    for (let k of nums.keys()) {
        let v = nums.get(k);
        if (C.has(v)) {
            continue;
        }
        if (v > 1) {
            C.set(v, sum - v + 1);
        } else {
            C.set(v, sum);
        }
    }
    //console.log("C", C);
    for (let i of a) {
        console.log(C.get(nums.get(i)));
    }
    return;
}
