#include<bits/stdc++.h>
#include<stdio.h>
#include<vector>
#include<deque>
#include<string>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#include<set>
#define ws " "
#define nl "\n"
#define tc ll test; cin>>test; while(test--)
#define f(i, a, b) for(ll i = a; i<b; i++)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mod 1000000007
#include<fstream>
#define MAXN 1000001

// stores smallest prime factor for every number
int spf[MAXN];

using namespace std;

#define pll pair<ll, ll>
bool compare(pll a, pll b)
{
	//for descending order replace with a.roll >b.roll
   if((a.ff < b.ff)||((a.ff==b.ff)&&a.ss<b.ss))
        return 1;
	else
		return 0;
}



/*bool compare(pll i, pll j)
{
	return (i.first<j.first)||((i.first==j.first)&&(i.second<j.second));
}*/
ll getSum(ll n)
{
   ll sum = 0;
   while (n != 0)
   {
       sum = sum + n % 10;
       n = n/10;
   }
   return sum;
}

void sieve()
{
	spf[1] = 1;
	for (ll i=2; i<MAXN; i++)

		// marking smallest prime factor for every
		// number to be itself.
		spf[i] = i;

	// separately marking spf for every even
	// number as 2
	for (ll i=4; i<MAXN; i+=2)
		spf[i] = 2;

	for (ll i=3; i*i<MAXN; i++)
	{
		// checking if i is prime
		if (spf[i] == i)
		{
			// marking SPF for all numbers divisible by i
			for (ll j=i*i; j<MAXN; j+=i)

				// marking spf[j] if it is not
				// previously marked
				if (spf[j]==j)
					spf[j] = i;
		}
	}
}

// A O(log n) function returning primefactorization
// by dividing by smallest prime factor at every step
vector<ll> getFactorization(ll x)
{
	vector<ll> ret;
	while (x != 1)
	{
		ret.push_back(spf[x]);
		x = x / spf[x];
	}
	return ret;
}ll countDivisors(ll n);
bool checkPrime(ll n);
int countFreq(string &pat, string &txt)
{
    int M = pat.length();
    int N = txt.length();
    int res = 0;

    /* A loop to slide pat[] one by one */
    for (int i = 0; i <= N - M; i++)
    {
        /* For current index i, check for
           pattern match */
        int j;
        for (j = 0; j < M; j++)
            if (txt[i+j] != pat[j])
                break;

        // if pat[0...M-1] = txt[i, i+1, ...i+M-1]
        if (j == M)
        {
           res++;
           j = 0;
        }
    }
    return res;
}
ll binaryToDecimal(ll n)
{
    ll num = n;
    ll dec_value = 0;

    // Initializing base value to 1, i.e 2^0
    ll base = 1;

    ll temp = num;
    while (temp) {
        ll last_digit = temp % 10;
        temp = temp / 10;

        dec_value += last_digit * base;

        base = (base * 2)%1000003;
    }

    return dec_value;
}

ll power(ll x, ll y, ll p)
{
    ll res = 1;     // Initialize result

    x = x % p; // Update x if it is more than or
                // equal to p

    if (x == 0) return 0; // In case x is divisible by p;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


ll power(ll x,  ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}

/*
void addEdge(int a, int b)
{
    adj[a].pb(b);
    adj[b].pb(a);
}*/


void solve(){
    int n;
    cin>>n;

    ll arr[n];
    f(i, 0, n)
    cin>>arr[i];

    int ct = 0;
    f(i, 0, n)
    f(j, 0,n)
    f(k, 0, n)
    {
        if((arr[i]+arr[j]>arr[k]&&arr[i]+arr[k]>arr[j]&&arr[k]+arr[j]>arr[i])&&(j>i&&k>j)&&(arr[i]!=arr[j]&&arr[i]!=arr[k]&&arr[k]!=arr[j]))
            {
           //     cout<<i<<ws<<j<<ws<<k<<nl;
                ct++;
    }
    }

    cout<<ct;
}


//1 3 4 2

int main()
{
    fastIO;
    //freopen("alchemy_input.txt","r",stdin);
   // freopen("outputFinal.txt","w",stdout);
    //cout<<3<<nl;
   // int i = 1;
 //   cout<<"Case #"<<i++<<" :"<<nl;
   // tc

        //cout<<"Case #"<<i+1<<" :"<<nl;
        solve();


 //   new_file<<"Learning File handling";    //Writing to file

}
/*
1
4
CDCD
CCDC
DDDD
CDDD*/


void fillPrefixSum(ll arr[], int n, ll prefixSum[])
{
    prefixSum[0] = arr[0];
    for (int i = 1; i <n; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];

}

bool checkPrime(ll n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (ll i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}
/*DDCDC
DCDCC
DCCDC
CCCCD
DCDDD

13323
23341
*/


Measured memory_bytes: 3640