"use strict";
let inp = require("fs").readFileSync("/dev/stdin", "utf8").slice(0, -1);
let max = inp.split('\n')[0]
let nums = inp.split('\n')[1].split(' ')
let formed_nums = [];
for (let i = 0; i < max; i++) {
    formed_nums.push(nums.filter(elm => i + 1 == elm).length || 0)
}
formed_nums.forEach((elm, i) => {
    let ans = 0;
    let arr = formed_nums.slice();
    arr[nums[i]-1]--;
    arr.forEach(elm => {
        if (elm >= 2) {
            ans += elm * (elm - 1) / 2
        }
    });
    console.log(ans)
})