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!int;
    auto A = readln.split.to!(int[]);
    auto grps = sort(A.dup).group;
    int[int] nums;
    
    //grps.array.writeln;
    
    foreach (tup; grps) {
        nums[tup[0]] = tup[1];
    }
    
    //nums.writeln;
    
    int all_num = grps.map!(a => a[1]*(a[1]-1)).sum / 2;
    
    foreach (k; 0 .. N) {
        //writeln("he", A[k], " ", nums[A[k]], " ", ((nums[A[k]])*(nums[A[k]]-1))/2, " ", ((nums[A[k]]-1)*(nums[A[k]]-2))/2 );
        if (A[k] !in nums) writeln(all_num);
        else writeln( all_num - (nums[A[k]] - 1) );
    }
}

