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

void main() {
  int n;
  readf("%d\n", &n);
  auto a = readln.chomp.split.map!(to!int);
  long[int] counts;
  foreach(ai;a) {
    long c = counts.get(ai, 0);
    counts[ai] = c+1;
  }
  long sum = 0;
  foreach(v;counts.byValue) sum += v*(v-1)/2;
  for(int k=0; k<n; k++) {
    long x = sum - counts[a[k]] + 1;
    writeln(x);
  }
}

