program making_triangle
  implicit none
  integer :: n, l(100) = 0, i, j, k, m = 0
  read(*,*) n
  read(*,*) l(1:n)
  do i = 1, n - 2
    do j = i + 1, n - 1
      if (l(j) == l(i)) cycle
      do k = j + 1, n
        if (l(k) == l(i)) cycle
        if (l(k) == l(j)) cycle
        if (l(i) >= l(j) + l(k)) cycle
        if (l(j) >= l(k) + l(i)) cycle
        if (l(k) >= l(i) + l(j)) cycle
        m = m + 1
      end do
    end do
  end do
  write(*,'(i0)') m
end program making_triangle