"use strict";
    
const nC2 = (n) => {
    return (n * (n - 1)) / 2  
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    let hashMap = {}
    
    // まず全体の答えを把握する
    for(let i=0; i<N; i++) {
        if(!hashMap[A[i]]) {
            hashMap[A[i]] = 1;
        } else {
            hashMap[A[i]]++;
        }
    }
    
    let allAnswer = 0;
    
    for(let key in hashMap) {
        if(hashMap[key] >= 2) {
            allAnswer += nC2(hashMap[key]);
        }
    }
    
    // console.log(allAnswer);
    // console.log(JSON.stringify(hashMap));
    
    let answer = [];
    
    // 抜いた状態で判定していく
    for(let i=0; i<N; i++) {
        let newHashValue = nC2(hashMap[A[i]] - 1);
        // console.log("hashMap[A[i]]" + hashMap[A[i]]);
        // console.log("newHashValue" + newHashValue);
        
        // if(newHashValue === 0) {
        //     newHashValue = 1;
        // }
        
        let diff = nC2(hashMap[A[i]]) - newHashValue;
        // console.log("diff" + diff)
        // console.log("-------");
        answer.push(allAnswer - diff);
    }
    
    console.log(answer.join("\n"));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));