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))
    |> Array.fold (fun state (k,v) ->
        Array.set state (k-1) v
        state) (Array.create N 0)
let sum =
    dists
    |> Array.fold (fun state v -> state+int64(v)*(int64(v)-1L)/2L) 0L

A
|> Array.iter (fun v ->
    let ans = sum + 1L - int64(dists.[v-1])
    stdout.WriteLine ans)