require "set"

N = gets.to_i
Ls = gets.split.map(&:to_i)

def tri?(a, b, c)
  a + b > c && b + c > a && c + a > b
end

count = 0

Ls[0..-3].each.with_index do |l, i|
  a = l
  Ls[i + 1..-2].each.with_index do |m, j|
    b = m
    Ls[i + 2..-1].each.with_index do |n, k|
      c = n
      if tri?(a, b, c) && a != b && b != c && c != a
        count += 1
      end
    end
  end
end

puts count
