program MakingTriangle
    implicit none

    integer(4) :: N
    real(8), allocatable :: L(:)
    integer(4) :: count
    integer(4) :: i, j, k

    read(*, *) N
    allocate(L(1:N))
    read(*, *) L

    count = 0
    do i = 1, N
        do j = i + 1, N
            do k = j + 1, N
                if (L(i) .ne. L(j) .and. L(i) .ne. L(k) .and. L(j) .ne. L(k) .and. &
                &   abs(L(i)-L(j)) < L(k) .and. L(k) < L(i) + L(j)) then
                    count  = count + 1
                end if
            end do
        end do
    end do

    write(*, *) count

end program MakingTriangle
        