n = gets.to_i
l = gets.split.map(&:to_i)

sum = 0
if n < 3
  sum = 0
elsif n>= 3
  (n-2).times {|i|
    (n-i-2).times{|j|
      (n-i-j-2).times{|k|
        if l[i] == l[i+j+1] || l[i] == l[i+j+k+2] || l[i+j+1] == l[i+j+k+2]
          sum += 0
        elsif l[i] + l[i+j+1] > l[i+j+k+2] && l[i] + l[i+j+k+2] > l[i+j+1] && l[i+j+1] + l[i+j+k+2] > l[i]
          sum += 1
        else sum += 0
        end
        }
      }
    }
end
  
p sum