open System 

type Explicit =          
    static member inline ($) (_:int32, _:Explicit) = int
    static member inline ($) (_:int64, _:Explicit) = int64

let inline convert (value:'a): 'b = 
    (Unchecked.defaultof<'b> $ Unchecked.defaultof<Explicit>) value

let inline fromInt (x: int): 'a = convert x

module NumericLiteralG =
    let inline FromZero(): ^a = LanguagePrimitives.GenericZero
    let inline FromOne(): ^a = LanguagePrimitives.GenericOne
    let inline FromInt32 n = fromInt n

let R() = Console.ReadLine()

let comb2 (x: int): int = 
    x * (x - 1) / 2

let f (xs: int array): int list =
    let g =
        xs 
        |> Array.groupBy id 
        |> Array.map (fun (k, v) -> k, Array.length v)
    let m = 
        g
        |> Map.ofArray
    let all =     
        g
        |> Array.map snd
        |> Array.fold (fun acc x -> 
            if x < 2 then acc 
            else acc + comb2 x
        ) 0
    [ for x in xs do 
        all - comb2 m.[x] + comb2 (m.[x] - 1)
    ]

let N = R()
let A = R().Split() |> Array.map (string >> int)

f A 
|> List.iter (printfn "%i")
