#ifdef PENIS_DETROV
    #include <iostream>
    #include <vector>
    #include <string>
    #include <set>
    #include <map>
    #include <algorithm>
    #include <utility>
    #include <cmath>
    #include <iomanip>
    #include <stack>
    #include <deque>
    #include <queue>
    #include <cstdio>
    #include <unordered_map>
    #include <unordered_set>
    #include <numeric>
    #include <cassert>
    #include <ext/rope>
    #include <random>
    #include <ctime>
    #include <chrono>
    #include <cassert>
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
#else
    #include<bits/stdc++.h>
#endif

#define int long long
#define f first
#define s second
#define sz(x) (int)(x.size())
#define pb push_back
#define vec vector
#define all(x) (x).begin(), (x).end()
#define ld long double
#define rall(x) (x).rbegin(), (x).rend()
#define pii pair< int, int >
#define psi pair< string, int >
#define pss pair< string, string >
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rz resize
#define ins insert
#define endl "\n"
#define FOR( i, n ) for( int i = 0 ; i < (n) ; i++ )
#define INF 1e18
#define inf 1e12
#define sum( a ) accumulate( all( a ), (int)0 )
#define rep( i, a, b ) for( int i = a ; i < b ; i++ )

using namespace std;
using namespace __gnu_cxx;

template <class T>
istream& operator >> ( istream & in, vec< T > & a )
{
    for ( auto & i : a )
        in >> i;
    return in;
}

template <class T>
ostream& operator << ( ostream & out, vec< T > & a )
{
    for ( auto & i : a )
        out << i << ' ';
    return out;
}

template < class T, class U >
istream& operator >> (istream & in, vec< pair < T, U > > & a )
{
    for ( auto & i : a )
        in >> i.f >> i.s;
    return in;
}

template <class T, class U>
ostream& operator << ( ostream & out, vec< pair < T, U > > & a )
{
    for ( auto & i : a )
        out << i.f << ' ' << i.s << endl;
    return out;
}

template <class T, class U>
ostream& operator << ( ostream & out, pair< T, U > &a )
{
    out << a.f << ' ' << a.s << endl;
    return out;
}

template < class T, class U >
istream& operator >> (istream & in, pair< T, U > &a )
{
    in >> a.f >> a.s;
    return in;
}

#ifdef FelixDzerzhinsky
    #define dbg(x) cout << (#x) << "\t" << (x) << endl
#else
    #define dbg(x) 238
#endif

#ifdef FelixDzerzhinsky
    mt19937 rnd(345345);
#else
    mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int max( int a, int b )
{
    if( a > b )
    {
        return a;
    }
    return b;
}

int min( int a, int b )
{
    if( a < b )
    {
        return a;
    }
    return b;
}

void start()
{
    freopen( "prizes.in", "r", stdin );
    freopen( "prizes.out", "w", stdout );
}

void Ios()
{
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
    cout.tie( 0 );
}


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

    vec< int > a (n);
    cin >> a;

    int cnt = 0;

    for( int i = 0 ; i < n ; i++ )
    {
        for( int j = i + 1 ; j < n ; j++ )
        {
            for( int k = j + 1 ; k < n ; k++ )
            {
                if( a[i] < a[j] + a[k] and a[k] < a[j] + a[i] and a[j] < a[i] + a[k] and a[i] != a[k] and a[i] != a[j] and a[j] != a[k] )
                {
                    cnt++;
                }
            }
        }
    }

    cout << cnt;
}

signed main()
{
    //start();
    Ios();

    int q = 1;
    //cin >> q;

    while( q-- )
    {
        solve();
    }
}











Measured memory_bytes: 3664