program abc40
 implicit none
 integer::N,ia,ib,ic,id,c=0
 integer,allocatable::L(:)
 read(*,*)N
 allocate(L(N))
 read(*,*)(L(ia),ia=1,N)
 do ib=1,N-2
  do ic=ib+1,N-1
   do id=ic+1,N
    if(iabs(L(ib)-L(ic))<L(id).and.L(ib)+L(ic)>L(id).and.L(ib)/=L(ic).and.L(ic)/=L(id).and.L(ib)/=L(id))then
     c=c+1
    end if
   end do
  end do
 end do
 print'(i0)',c
 deallocate(L)
end program abc40