#include<bits/stdc++.h>
#define ll long long int
#define ld double
#define pp push
#define ff first
#define ss second
#define mkpr make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define sot(v) sort(v.begin(),v.end());
#define scan(any)       for(auto &i:any) cin>>i;
#define print(any)      for(auto i:any) cout<<i<<" ";
#define endl            '\n'
#define pb push_back
#define vll       vector<ll>
#define mll       map<ll,ll>
#define f(i,x,y)  for(ll i=x;i<y;i++)
#define INF     LLONG_MAX
#define fast    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define p2(n,x)    cout << fixed << setprecision(x) <<n<<endl;
#define mod 1000000007
using namespace std;

ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
ll modInv(ll a, ll m);
ll gcdExtended(ll a, ll b, ll *x, ll *y);
bool isPrime(ll n);

ll lvl[1000][1000];
bool A[1000][1000];

ll modInv(ll a, ll m){
    ll x, y;
    ll g = gcdExtended(a, m, &x, &y);
    ll res = (x%m + m) % m;
    return res;
}

ll gcdExtended(ll a, ll b, ll *x, ll *y){
    if (a == 0){
        *x = 0, *y = 1;
        return b;
    }
    ll x1, y1;
    ll gcd = gcdExtended(b%a, a, &x1, &y1);
    *x = y1 - (b/a) * x1;
    *y = x1;
    return gcd;
}
ll gcd(ll x, ll y)
{
        return (x==0)? y : gcd(y % x, x);
}
ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

void addEdge(vll adj[], ll u, ll v)
{
    adj[u].push_back(v);
    adj[v].push_back(u);
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res% mod;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}

ll pow(ll base, ll expo, ll m) {
    if(m==1) return 0;
    ll ans=1,y=base%m;
    while(expo>0){
        if(expo&1)
         ans=((ans)*y)%m;
        y=(y*y)%m;
        if(y<0) y+=m;
        expo=expo>>1;
    }
    if(ans<0){
        ans=(m-abs(ans)%m);
        return ans;
    }
    return ans%m;
}

vll Divisors(ll n)
{
    vll vec;
    vec.clear();
    for (ll i=1; i<=sqrt(n); i++)
    {
        if (n%i == 0)
        {
            if (n/i == i)
                vec.pb(i);
            else
            {
                vec.pb(i);
                vec.pb(n/i);
            }
        }
    }
    return vec;
}

void DFSE(vll adj[],vector<bool> &visited,ll u)
{
    ll i;
    visited[u] = true;
    cout<<u<<" ";
    f(i,0,adj[u].size())
    {
        if(visited[adj[u][i]]==false)
        {
            DFSE(adj,visited,adj[u][i]);
        }
    }

}
void DFS(vll adj[],ll u,ll v)
{
    ll i;
    vector<bool> visited(v,false);
    f(i,0,v)
    {
        if(visited[i]==false)
        {
            DFSE(adj,visited,i);
        }
    }
}


void slv()
{
    ll t,n,m,p,r,c,d,x,y,z,k,h,e,l,u,i,j,a,b;
    string s,s1,s2;
    cin>>n;
    ll ar[n];
    f(i,0,n)    cin>>ar[i];
    sort(ar,ar+n);
    ll ans=0;
    f(i,0,n-2)
    {
        f(j,i+1,n-1)
        {
            f(k,j+1,n)
            {
                if(ar[i]+ar[j]>ar[k] && ar[i]!=ar[j] && ar[k]!=ar[j] && ar[i]!=ar[k])
                {
                    ans++;
                    //cout<<i+1<<" "<<j+1<<" "<<k+1<<endl;
                }
            }
        }
    }
    cout<<ans<<endl;
}

int main()
{
    fast
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        slv();
    }
}


Measured memory_bytes: 3684