import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;

void main() {
	auto n = readln.chomp.to!int;
	auto a = readln.chomp.split(" ").map!(to!long).array;
	long[long] table;
	
	foreach (e;a) {
		++table[e];
	}

	table.rehash;

	long patterns = 0;
	foreach (value;table.values) {
		patterns += value * (value - 1) / 2;
	}

	foreach (e;a) {
		auto v = table[e];
		if (v < 2) {
			writeln(patterns);
		} else {
			writeln(patterns - (v * (v - 1) / 2) + ((v - 1) * (v - 2) / 2));
		}
	}
}
