Imports System.Collections.Generic
Module D
    Sub Main(ByVal args() As String)
        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim A_i() As String = Split(Console.ReadLine())
        Dim i, j As Integer
        Dim dic As New Dictionary(Of Integer, Integer)
        Dim key_arr(), val_arr() As Integer
        Dim result As Integer
        For j = 0 To N - 1
            If dic.ContainsKey(A_i(j)) Then
                dic(A_i(j)) += 1
            Else
                dic.Add(A_i(j), 1)
            End If
        Next
        ReDim key_arr(dic.Count - 1)
        ReDim val_arr(dic.Count - 1)
        dic.Keys.CopyTo(key_arr, 0)
        dic.Values.CopyTo(val_arr, 0)
        Array.Sort(val_arr, key_arr, StringComparer.Ordinal)
        For i = 0 To N - 1
            result = 0
            For j = dic.Count - 1 To 0 Step -1
                If key_arr(j) = A_i(i) Then
                    If val_arr(j) > 2 Then
                        result += (val_arr(j) - 1) * (val_arr(j) - 2) / 2
                    Else
                        Continue For
                    End If
                Else
                    If val_arr(j) > 1 Then
                        result += val_arr(j) * (val_arr(j) - 1) / 2
                    Else
                        Exit For
                    End If
                End If
            Next
            Console.WriteLine(result)
        Next
    End Sub
End Module