import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    auto l = aryread();
    l.sort();
    long ans;
    foreach (i; 0 .. n)
    {
        foreach (j; i + 1 .. n)
        {
            foreach (k; j + 1 .. n)
            {
                if ((l[i] == l[j]) || (l[j] == l[k]) || (l[i] == l[k]))
                {
                    continue;
                }
                else
                {
                    if (l[i] + l[j] > l[k])
                    {
                        ans += 1;
                    }
                }
            }
        }
    }
    writeln(ans);
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
