PROGRAM B
  IMPLICIT NONE
  INTEGER :: n,i,j,k
  INTEGER :: count=0
  INTEGER,allocatable :: l(:)
  READ *, n
  allocate(l(n))
  READ *, l

  DO i=1,n
  DO j=1,n
  DO k=1,n
    IF(l(i)/=l(j) .and. l(j)/=l(k) .and. l(k)/=l(i)) THEN
      IF(l(i) < (l(j)+l(k)) ) THEN
        IF(l(j) < (l(k)+l(i)) ) THEN
          IF(l(k) < (l(i)+l(j)) ) THEN
            count=count+1
          END IF
        END IF
      END IF
    END IF
  END DO
  END DO
  END DO
  deallocate(l)
  PRINT *, count/6
END PROGRAM B
