program make_triangle
      integer :: n
      integer,allocatable :: l(:)
      integer :: i, j, k
      integer :: t(3)

      read *, n
      allocate(l(n))
      do i = 1, n
        read *, l(i)
      end do

      do i = 1, n-1
        do j = i + 1, n
          if(l(i) .gt. l(j))then
            k = t(i)
            t(i) = t(j)
            t(j) = k
          end if
        end do
      end do

      do i  = 1, n
        do j = 1, i-1
          do k = 1, j-1
            if(t(k) /= t(j) .and. t(i) /= t(j) .and. t(k) + t(j) > t(i))then
              ans = ans + 1
            end if
          end do
        end do
      end do
end program