program main
  implicit none
  integer :: n, i, j, k, counts
  integer, allocatable :: l(:)
  
  read(*,*) n
  
  allocate( l(n) )
  read(*,*) ( l(i), i = 1, n )
  
  counts = 0
  
  do i = 1, n-2
    do j = i+1, n-1
      do k = j+2, n
        if ( l(i)+l(j) > l(k) .and. l(j)+l(k) > l(i) .and. l(k)+l(i) > l(j) ) then
          if( l(i) == l(j) .or. l(i) == l(k) .or. l(j) == l(k) ) then
            counts = counts
          else
            counts = counts + 1
          endif
        else
          counts = counts
        endif
      enddo
    enddo
  enddo
  
  write(*,*) counts
  
end program main