Main=(o=>{"use strict";o=o.split("\n")[1].split(" ");let s={};for(const t of o)s[t]=(s[t]||0)+1;for(const o of Object.keys(s))s[o]={b:s[o]*(s[o]-1)/2,c:(s[o]-1)*(s[o]-2)/2};var t;for(const o of Object.keys(s)){t=0;for(const c of Object.keys(s))t+=o==c?s[c].c:s[c].b;s[o].d=t}for(const t of o)console.log(s[t].d)}); Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());