import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void calc(long[] a) {
    long[long] freq;
    foreach (x; a) freq[x]++;

    long sum = 0;
    foreach (v; freq.values) {
        sum += v * (v - 1) / 2;
    }

    long[long] map; // 各ボールごとの組み合わせ数
    foreach (k, v; freq) {
        map[k] = v * (v - 1) / 2;
    }

    foreach (x; a) {
        long ans = sum - map[x];
        long k = freq[x] - 1;
        if (k > 1) ans += k * (k - 1) / 2;
        writeln(ans);
    }
}

void main() {
    readint;
    auto a = reads!long;
    calc(a);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
