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);
  int[int] counts;
  foreach(ai;a) {
    int c = counts.get(ai, 0);
    counts[ai] = c+1;
  }
  for(int k=0; k<n; k++) {
    long result = 0;
    foreach(ai;counts.byKey) {
      if(ai == a[k]) result += (counts[ai]-1)*(counts[ai]-2)/2;
      else result += counts[ai]*(counts[ai]-1)/2;
    }
    writeln(result);
  }
}

