program b175

implicit none
integer(16) :: n, i, j, k, z, m
integer(16), allocatable :: l(:)

z = 0

read *, n

allocate(l(1:n))

read *, l(:)

!print '(I1)', l(:)

  do i=1,n-1
     do j=i+1,n
        if(l(i) < l(j))then
           m = l(i)
           l(i) = l(j)
           l(j) = m
        end if
     end do
  end do

!print '(I1)', l(:)

do i = 1, n
 do j = i+1, n
  do k = j+1, n
   !print '(3(I1))', l(i), l(j), l(k)
   if(l(i) - l(j) < l(k) .and. l(j) /= l(k) .and. l(i) /= l(j)) then
   !print *, 'o'
   z = z + 1
   end if
  end do
 end do
end do

print *, z

end program b175