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

void main() {
    //auto N = readln.split[0].to!ulong;
    //auto A = readln.split.to!(ulong[]);
    
    auto N = 200_000;
    string input = "";
    foreach (i; 0 .. N) input ~= "24343 ";
    auto A = input.split.to!(ulong[]);
    
    auto grps = sort(A.dup).group.array;
    size_t[ulong] nums;
    
    foreach (tup; grps) {
        nums[tup[0]] = tup[1];
    }
    
    ulong all_num = grps.map!(a => cast(ulong) a[1] * cast(ulong) (a[1]-1)).sum / 2;
    
    foreach (k; 0 .. N) {
        writeln( all_num_true - (nums[A[k]] - 1) );
    }
    
}

