
# 棒の本数
num = gets.to_i
# 棒の長さ
l = gets.chomp.split.sort.map(&:to_i)
# 答えの変数
ans = 0
# 全探索
if num < 3
  puts ans
else
  for i in 0 .. (num - 3) do
    for j in (i + 1) .. (num - 2) do
      for k in (j + 1) .. (num - 1) do
        if (l[i] + l[j] > l[k]) && (l[i] < l[j]) && (l[j] < l[k])
          ans += 1
        end
      end
    end
  end
  puts ans
end
