// inputに入力データ全体が入る
function Main(input) {
    var N = input[0]-0;
    var map = {};
    var map2 = {};
    var list = input[1].split(" ").map(v=>v-0).sort((a,b)=>a-b);
    var ansmap = {};
    var sum = 0;
    list.forEach((v,i)=>{
        if(ansmap[v]){
            ansmap[v]++;
            if(list[i+1]!=v)
                sum += ansmap[v]*(ansmap[v]-1)/2;
        }else{
            ansmap[v] = 1;
            if(list[i+1]!=v)
                sum += ansmap[v]*(ansmap[v]-1)/2;
        }
    });
    var anss = [];
    input[1].split(" ").forEach(v=>{
        anss.push(sum-((ansmap[v]-1)));
    });

    console.log(anss.join("\n"));
}

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