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

