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]()
for e in array { 
  if dic[e] != nil {
    dic[e] = dic[e]! + 1
  } else {
    dic[e] = 1
  }
}
for e in array {
  var answer = 0
  for f in dic {
    var endIndex = f.1
    if e == f.0 { endIndex -= 1 }
    for g in 0 ..< endIndex {
      answer += g
    }
  }
  print(answer)
}
