
# 棒の本数
num = gets.to_i
# 棒の長さ
l = gets.chomp.split.map(&:to_i)
l.sort!
# 答えの変数
ans = 0
# 全探索

for i in 0 .. (num - 3) do
  for j in (i + 1) .. (num - 2) do
    next if l[i] == l[j]
    for k in (j + 1) .. (num - 1) do
      next if l[k] == l[j]
      break if l[i] + l[j] <= l[k]
      ans += 1
    end
  end
end
