import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let S = Int(split[1])!

// 1 2 3 4 5
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
*/

let N = Int(readLine()!)!
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var dic = [Int: Int]()
var answer = 0
for e in array { 
  if dic[e] != nil {
    dic[e] = dic[e]! + 1
  } else {
    dic[e] = 1
  }
  answer += dic[e]! - 1
}

for e in array {
  print(answer - dic[e]! + 1 )
}