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 result As Integer
        For i = 0 To N - 1
            dic.Clear()
            result = 0
            For j = 0 To N - 1
                If i <> j Then
                    If dic.ContainsKey(A_i(j)) Then
                        dic(A_i(j)) += 1
                    Else
                        dic.Add(A_i(j), 1)
                    End If
                End If
            Next
            If dic.Count = 1 Then
                result = (N - 1) * (N - 2) / 2
            ElseIf dic.Count = N - 1 Then
                result = 0
            Else
                Dim wA_i(dic.Count - 1) As Integer
                dic.Values.CopyTo(wA_i, 0)
                Array.Sort(wA_i, StringComparer.Ordinal)
                For j = dic.Count - 1 To 0 Step -1
                    If wA_i(j) > 1 Then
                        result += wA_i(j) * (wA_i(j) - 1) / 2
                    Else
                        Exit For
                    End If
                Next
            End If
            Console.WriteLine(result)
        Next
    End Sub
End Module