#include <bits/stdc++.h>
//using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
#define lld long long int
#define ulld unsigned long long int
#define SIZE 5 * 1000000 + 10
#define ff first
#define ss second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define fbo find_by_order
#define ofk order_of_key
#define fo(i, a, b) for (lld i = a; i <= b; i++)
#define fl(j, c, d) for (lld j = c; j <= d; j++)
#define FOR(i, n) for (lld i = 0; i < n; i++)
#define F0R(j, n) for (lld j = 0; j < n; j++)
#define ROF(i, n) for (lld i = n; i >= 0; i--)
#define scc(ch) scanf("%c", &ch)
#define sc1(a) scanf("%lld", &a)
#define sc2(a, b) scanf("%lld %lld", &a, &b)
#define sc3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define rs random_shuffle
#define mod 1000000007
#define setbit __builtin_popcount
#define elif else if
#define pi 2 * acos(0.0)
#define inf 9000000000000000000
#define T            \
    int t;           \
    scanf("%d", &t); \
    while (t--)
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
/*bool compare(const pair<lld, lld> &a, const pair<lld, lld> &b)
{
    return a.ss < b.ss;
}

bool ispowtwo(lld n)
{
    return n and (!(n & (n - 1)));
}
bool isprime(lld n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return false;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (lld i = 5; i * i <= n; i += 6)
    {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    }
    return true;
}
lld power(lld base,unsigned int n)
{
    lld res=1;
    while(n)
    {
        if(n&1)
            res=res*base;

        base=base*base;
        n=n/2;
    }
    return res;
}

lld modpow(lld base,lld n,lld m)
{
    lld res = 1;
    while (n)
    {
        if (n%2==1)
            res = ((res%m) * (base%m)) % m;
        base = ((base%m) * (base%m)) % m;
        n = (n/2);
    }
    return res;
}

vector<lld> prime, getprime;
void sieve(lld n)
{
    bool mark[(1000000 >> 1) + 2];
    memset(mark, true, sizeof(mark));
    if (n >= 4)
    {
        for (lld i = 3; i * i <= n; i += 2)
        {
            if (mark[i >> 1] == true)
            {
                for (lld j = i * i; j <= n; j += 2 * i)
                    mark[j >> 1] = false;
            }
        }
    }

    if (n > 1)
        prime.pb(2);
    for (lld i = 3; i <= n; i += 2)
    {
        if (mark[i >> 1] == true)
            prime.pb(i);
    }
}

void segmented_sieve(lld l, lld r)
{
    sieve(sqrt(r));
    bool mark[r - l + 2];
    memset(mark, true, sizeof(mark));
    for (lld i = 0; i < prime.size(); i++)
    {
        lld low = (l / prime[i]) * prime[i];
        if (low < l)
            low += prime[i];
        for (lld j = low; j <= r; j += prime[i])
        {
            if (j != prime[i])
                mark[j - l] = false;
        }
    }

    for (lld i = l; i <= r; i++)
    {
        if (mark[i - l] == true && i > 1)
            getprime.pb(i);
    }
}

lld phi[SIZE];
void euler_totient()
{
    for (lld i = 1; i <= SIZE; i++)
    {
        phi[i] = i;
    }

    for (lld i = 2; i <= SIZE; i++)
    {
        if (phi[i] == i)
        {
            for (lld j = i; j <= SIZE; j += i)
                phi[j] -= phi[j] / i;
        }
    }
}*/

int main()
{
#ifndef ONLINE_JUDGE
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif

    lld n,i,j,k;
    cin>>n;
    lld a[n];
    FOR(i,n)
    {
        cin>>a[i];
    }

    if(n<=2)
        cout<<0<<endl;
    else
    {
        sort(a,a+n);
        lld ans=0;
        FOR(i,n-2)
        {
            for(j=i+1;j<n-1;j++)
            {
                for(k=j+1;k<n;k++)
                {
                    if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
                    {
                        if(a[i]+a[j]>a[k])
                            ans++;
                    }
                }
            }
        }

        cout<<ans<<endl;
    }
    cerr << "time taken : " << (float)clock() / (float)CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}


Measured memory_bytes: 3704