Imports System

Module Program
    Sub Main(args As String())

        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim tmp() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()



        Dim ans As Integer = 0
        For i As Integer = 0 To N - 3
            For j As Integer = i + 1 To N - 2
                Dim min As Integer = tmp(i)
                Dim max As Integer = tmp(i)
                If tmp(i) <> tmp(j) Then
                    If tmp(i) < tmp(j) Then
                        max = tmp(j)
                    Else
                        min = tmp(j)
                    End If
                    For k As Integer = j + 1 To N - 1
                        If tmp(i) <> tmp(k) AndAlso tmp(j) <> tmp(k) Then
                            If min < tmp(k) Then
                                If tmp(k) < max Then
                                    If min + tmp(k) > max Then
                                        ans += 1
                                    End If
                                Else
                                    If min + max > tmp(k) Then
                                        ans += 1
                                    End If
                                End If
                            Else
                                If tmp(k) + min > max Then
                                    ans += 1
                                End If
                            End If
                        End If
                    Next
                End If
            Next
        Next

        Console.WriteLine(ans)

    End Sub
End Module
