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

T c2(T)(T x) {
	if (x % 2 == 0) {
		return (x / 2) * (x - 1);
	} else {
		return ((x - 1) / 2) * x;
	}
}

void main() {
	auto n = readln.chomp.to!int;
	auto a = readln.chomp.split(" ").map!(to!int).array;
	auto sa = a.dup;
	sort(sa);
	auto gs = group(sa).array;
	auto g0 = gs.map!"a[0]".array;
	auto g1 = gs.map!"a[1]".array;
	
	foreach (e;a) {
		long patterns = 0;

		foreach (size_t i, g;g1) {
			if (g0[i] == e) {
				if (g > 2) {
					patterns += c2(g);
				}
			} else {
				patterns += c2(g);
			}
		}

		writeln(patterns);
	}
}
