import Foundation
let N = Int(String(readLine()!))!
let nums = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var table: [Int: Int] = [:]
var sum = 0
for n in nums {
  table[n] = (table[n] ?? 0) + 1
}
for (key, value) in table {
  sum += value * (value - 1) / 2
}
for n in nums {
  print(sum - table[n]! + 1)
}