Imports System.Text
Imports System.String
Imports System
Imports System.Math

Module Module1

    Sub Main()
        Dim ans As String = ""

        Dim getvaluelength As Integer


        getvaluelength = CInt(Console.ReadLine)

        Dim mojiretu() As String = Console.ReadLine().Split(" "c)

        Dim check(getvaluelength) As Integer

        For Each str As String In mojiretu
            Dim i As Integer = CInt(str)
            check(i) = check(i) + 1
        Next

        Dim kumiawasesu As Integer = 0

        For Each tempint As Integer In check
            If tempint <= 1 Then
                Continue For
            End If

            kumiawasesu = kumiawasesu + CInt(((tempint * (tempint - 1)) / 2))

        Next

        For Each str As String In mojiretu
            Dim i As Integer = CInt(str)

            If check(i) <= 1 Then
                Console.WriteLine(kumiawasesu)
                Continue For
            ElseIf check(i) = 2 Then
                Console.WriteLine(kumiawasesu - 1)
                Continue For
            Else
                Console.WriteLine(kumiawasesu - CInt(((check(i) * (check(i) - 1)) / 2)) + CInt(((check(i) - 1) * (check(i) - 2)) / 2))
                Continue For
            End If


        Next


        Console.ReadKey()
    End Sub




End Module