import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);
  long[int]cnt;
  foreach (e; a) {
    cnt[e]++;
  }
  long[int] res;
  long base;
  foreach (k; cnt.keys) {
    if (cnt[k] == 1) {
      res[k] = 0;
    } else {
      res[k] = (cnt[k] * (cnt[k] - 1)) / 2;
      base += res[k];
    }
  }

  foreach (i; 0..n) {
    auto sum = base - res[a[i]];
    if (cnt[a[i]] > 2) {
      sum += ((cnt[a[i]]-1) * (cnt[a[i]] - 2)) / 2;
    }
    sum.writeln;
  }
}
