! 2019.10.19
!
      program answer
      implicit none
      integer :: N
      integer,allocatable,dimension(:) :: L
      integer :: sorting
      integer,allocatable,dimension(:) :: L_sorted
      integer :: ans
      integer :: i,j,k
!
      read(*,*) N
      allocate(L(N),L_sorted(N))
      read(*,*) (L(i),i=1,N)
! sorting L(i) [i=1,2,...] to ascending order
! bubble sorting algorism
      do i=1,N-1
        do j=i+1,N
          if(L(i) .gt. L(j)) then
            sorting = L(i)
            L(i) = L(j)
            L(j) = sorting
          end if
        end do
      end do
!
      ans = 0
!
      do i=1,N-1
      lp2:do j=i+1,N
           do k=1,N
            if(i == k .or. j == k) then
            else if(L(j)-L(i) .lt. L(k)) then
              if(L(j)+L(i) .gt. L(k)) then
                ans = ans + 1
              else
                cycle lp2
              end if
            end if
          end do 
        end do lp2
      end do
!
      write(*,*) ans/3
!
      end program answer