      PROGRAM piyo
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 16
      integer(p) :: n,ans, i,j,k,sumVal,maxVal
      integer(p),allocatable :: l(:)
      
      read*,n
      allocate(l(n))
      read*,l
      
      if( n==1.or.n==2 )then
        print*,0
        stop
      end if
      
      ans = 0
      do i = 1,n-2
        do j = i+1,n-1
          do k = j+1,n
            
            if( l(i)==l(j).or.l(j)==l(k).or.l(k)==l(i) ) cycle
            
            sumVal = l(i) + l(j) + l(k)
            maxVal = max(l(i),l(j),l(k))
            if( sumVal-maxVal<=maxVal ) cycle
            
            ans = ans + 1
          end do
        end do
      end do
      
      print*,ans
      
      
      
      stop
      !debugg
      
      
      
      END PROGRAM