//----ak_lm10----
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

//TYPEDEFS
typedef long long int ll;
typedef unsigned long long int uli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<ll,ll>> vpll;
typedef set<int> si;
typedef set<ll> sll;
//DEFINES
#define PI 3.1415926535897932384
#define fastIO  std::ios::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007
#define mod1 1000000009
#define mod2 998244353
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define rep(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REP(i, k, n) for (ll (i) = (k); (i) < (n); (i)++)
#define repr(i, k, n) for (ll (i) = (k); (i) >= (n); (i)--)
#define pb push_back
#define popb pop_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(x) x.be,x.en
#define rall(x) x.rbegin(),x.rend()
#define sortinc(x) sort(all(x))
#define sortdec(x) sort(rall(x))
#define tr(it, a) for(auto (it) = a.begin(); (it) != a.end(); (it)++)
#define p0(a) cout << (a) << " "
#define p1(a) cout << (a) << endl
#define p2(a, b) cout << (a) << " " << (b) << endl
#define p3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define p4(a, b, c, d) cout << (a) << " " << (b) << " " << (c) << " " << (d) << endl
#define cend cout<<endl
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define inpi in<int>()
#define inpll in<ll>()
#define inps in<string>()
#define r0 return 0
#define e0 exit(0)
#define F first
#define S second
#define setBits(x) _builtin_popcount(x)
#define setBitsll(x) _builtin_popcountll(x)
#define parity(x) _builtin_parity(x)
#define leadZero(x) __builtin_clz(x)
#define leadZeroll(x) __builtin_clzll(x)
#define trailZero(x) __builtin_ctz(x)
#define w(t) int t; cin>>t; while(t--)
#define CASE(t) int t; cin>>t; rep(i,t){cout<<"Case #"<<i+1<<":\n";}
#define debug(x) cout << #x << " is " << x << endl;
//TEMPLATES
template <typename T>
T in(){
    T x;
    cin >> x;
    return x;
}
template <typename T>
void print(vector<T> v){
    for (auto i : v){
        cout << i << " ";
    }
    cout << endl;
}
template <typename T>
void printArr(T *arr, int s, int n){
    for(int i=s;i<=n;i++){
        cout<<arr[i]<<" ";
    }
    cout<<endl;
}
template <typename T>
void cmp(pair<T, T> &a, pair<T, T> &b ){
    return a.S>b.S;
}
int main(){
    fastIO;
    
    int t=1;
    // cin>>t;
    while(t--){
        int n=inpi;
        vll a(n);
        rep(i,n){
            cin>>a[i];
        } 
        sortinc(a);
        ll cnt=0;
        rep(i,n){
            REP(j,i+1,n){
                // if(a[i]==a[j])
                // continue;
                REP(k,j+1,n){
                    // if(a[i]==a[k] || a[j]==a[k])
                    //     continue;
                    if(a[i]+a[j]>a[k] && a[i]!=a[j] && a[j]!=a[k])
                        cnt++;
                }
            }
        }
        p1(cnt);
    }
    return 0;
}


Measured memory_bytes: 3648