#include <bits/stdc++.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>

using namespace std;
using boost::algorithm::split;
using boost::algorithm::join;
using boost::algorithm::replace_all;

#define rep(i,n) for(size_t i=0;i<static_cast<size_t>(n);i++)
#define reps(i,n,s) for(size_t i=static_cast<size_t>(s);i<static_cast<size_t>(n);i++)
#define isposi(num) if(num>0)
#define MOD 1000000007;
#define PI 3.141592653589793

template <typename T, template <typename TYPE, typename=std::allocator<TYPE>> class C>
class cutils{
public:
    //FUNCTION
    cutils(size_t size=0){container.resize(size);}
    void resize(const size_t size){container.resize(size);}
    void reserve(const size_t size){container.reserve(size);}
    void push_back(const T value){container.push_back(value);}
    void pop_back(){container.pop_back();}
    void push(const C<T> value){rep(i,value.size())container.push_back(value[i]);}
    void erase(const size_t index){container.erace(index);}
    void erase(const size_t first,const size_t last){container.erace(first,last);}
    void clear(){container.clear();}
    C<T> get(){return container;};
    T at(const size_t index){return container[index];}
    size_t size(){return container.size();};
    size_t begin(){return container.begin();}
    size_t end(){return container.end();}
    bool empty(){return container.empty();}
    bool find(const T target,const size_t first=0,const size_t last=0){if(std::find(container.begin()+first,container.end()+last,target)!=container.end())return true;else return false;}
    size_t count(const T target,const size_t first=0,const size_t last=0){return std::count(container.begin()+first,container.end()+last,target);}
    void swap(C<T> value){container.swap(value);}
    void swap(const size_t l,const size_t r){T temp=container[l];container[l]=container[r];container[r]=temp;}
    void asc_sort(const size_t first=0,const size_t last=0){sort(container.begin()+first,container.end()+last);}
    void des_sort(const size_t first=0,const size_t last=0){sort(container.begin()+first,container.end()+last,std::greater<T>());}
    void reverse(const size_t first=0,const size_t last=0){std::reverse(container.begin()+first,container.end()+last);}
    //OPERATOR
    bool operator==(C<T> value){if(value.size()!=container.size()){cout<<"ERROR OCCURED IN cutils bool operator==(C<T> value):Target container size is not equivalent to this container.\n";exit(-1);}rep(i,value.size())if(value[i]!=container[i])return false;return true;}
    cutils& operator=(C<T> value){container=value;return *this;}
    T operator[](size_t index)const{return container[index];}
    T& operator[](size_t index){return container[index];}
    //FOR_DEBUG
    void show(){rep(i,container.size()){cout<<container[i];if(i+1==container.size())cout<<"\n";else cout<<",";}}
private:
    C<T> container;
};

int main(void){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << std::setprecision(15);
    //
    int n,ans=0;
    cutils<int,vector> vi;
    cin>>n;
    vi.resize(n);
    rep(i,n)cin>>vi[i];
    if(n<3)cout<<0;
    else{
        rep(i,n){
            rep(j,n){
                if(i>=j)continue;
                rep(k,n){
                    if(j>=k)continue;
                    if(vi[i]!=vi[j]&&vi[j]!=vi[k]&&vi[i]!=vi[k]){
                        if(vi[i]+vi[j]>vi[k]&&vi[j]+vi[k]>vi[i]&&vi[i]+vi[k]>vi[j])ans++;
                    }
                }
            }
        }
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 3624