import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    auto B = new long[](N+10);
    long ans = 0;

    foreach (a; A) B[a] += 1;
    foreach (b; B) ans += b * (b - 1) / 2;

    foreach (a; A) writeln(ans - B[a] * (B[a] - 1) / 2 + (B[a] - 1) * (B[a] - 2) / 2);
}