let N =
    stdin.ReadLine()
    |> int
let A =
    stdin.ReadLine().Split()
    |> Array.map int

let dists =
    A
    |> Array.indexed
    |> Array.groupBy (fun (_,v) -> v)
    |> Array.map (fun (k,vs) -> (k,vs.Length))
let distMap =
    dists
    |> Map.ofArray
let sum =
    dists
    |> Array.fold (fun state (_,v) -> state+int64(v)*int64(v)) 0L

A
|> Array.iter (fun v ->
    let l = int64(distMap.[v])
    let ans = (sum - l*l + (l-1L)*(l-1L) + 1L - int64(N))/2L
    stdout.WriteLine ans)