# https://atcoder.jp/contests/abc175/tasks/abc175_b

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

ans = 0
0.upto(N - 3) do |i|
  (i + 1).upto(N - 2) do |j|
    next if Ls[i] == Ls[j]

    lij = Ls[i] + Ls[j]
    ans += (j + 1).upto(N - 1).count do |k|
      Ls[j] != Ls[k] && lij > Ls[k]
    end
  end
end

puts ans
