program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: i,j,k,n,ans=0,a,b,c,m1,m2,o
    integer(int64), allocatable:: l(:)

    read*, n
    allocate(l(n))
    read*, l(:)
    
    do i=1,n-2
        a = l(i)
        do j=i+1,n-1
            b = l(j)
            do k=j+1,n
                c = l(k)
                if (a /= b .and. b/=c .and. c/=a) then
                    m1 = max(a,b,c)
                    m2 = min(a,b,c)
                    o=0
                    if (m1 /= a .and. m2 /= a) o = a
                    if (m1 /= b .and. m2 /= b) o = b
                    if (m1 /= c .and. m2 /= c) o = c
                    if (m1 < m2+o) then
                        ans=ans+1
                    end if
                end if
            end do
        end do
    end do
    print'(i0)', ans
end program main