#!/usr/bin/env ruby

N = gets.chomp.to_i

L = gets.chomp.split.map(&:to_i)

count = 0

0.upto(N-3) do |i|
  (i+1).upto(N-2) do |j|
    (j+1).upto(N-1) do |k|
      a, b, c = [L[i], L[j], L[k]].sort

      next if a == b || b == c || c == a

      count += 1 if a + b > c
    end
  end
end

puts count
