local function upper_bound(key,ary)
    local n=#ary
    if n==0 then
        return 1 
    end
    if key<ary[1] then
        return 1
    end
    if key>=ary[n] then
        return n+1
    end
    local min,max=1,n
    while 1<max-min do
        local mid=(min+max)//2
        if key>=ary[mid] then
            min=mid
        else
            max=mid
        end
    end
    return max
end

local function lower_bound(key,ary)
    local n=#ary
    if n==0 then
        return 1 
    end
    if key<=ary[1] then
        return 1
    end
    if key>ary[n] then
        return n+1
    end
    local min,max=1,n
    while 1<max-min do
        local mid=(min+max)//2
        if key>ary[mid] then
            min=mid
        else
            max=mid
        end
    end
    return max
end

----------

local n=io.read("n")
local l={}
for i=1,n do
    l[i]=io.read("n")
end
table.sort(l)

local comb=0
for i=1,n-2 do
    for j=i+1,n-1 do
        for k=j+1,n do
            if l[i]~=l[j] and l[j]~=l[k] and l[k]~=l[i] then
                if l[i]+l[j]>l[k] then
                    comb=comb+1
                end
            end
        end
    end    
end
print(comb)