program answer
  implicit none
  integer(8) :: i, j, k, N, aa
  integer(8), allocatable :: L(:)
  read(*,*) N
  allocate(L(N))
  read(*,*) L

  !do i = 1, N-1
  !   do j = i+1, N
  !      if(L(i)>L(j)) then
  !      L(i)=aa
  !      L(i)=L(j)
  !      L(j)=aa
  !   end do
  !end do

  aa=0
  do i = 1, n-2
     do j = i+1, n-1
        do k = j+1, n
           if(L(i)+L(j)>L(k).and.L(i)+L(k)>L(j).and.L(j)+L(k)>L(i)) then
              if(L(i)/=L(j).and.L(i)/=L(K).and.L(j)/=L(k)) then
                 aa=aa+1
              end if
           end if
        end do
     end do
  end do

  write(*,*) aa
  stop
 end program answer