#include <bits/stdc++.h>
using namespace std;

int main(){
    int N, count;
    cin >> N;
    count = 0;
    vector<int> vec(N);
    for(int i = 0; i < N; i++){
        cin >> vec.at(i);
    }
    for(int i = 0; i < N; i++){
        for(int j = 0; j < i; j++){
            for(int k = 0; k < j; k++){
                if((abs(vec.at(i) - vec.at(j)) < vec.at(k) && vec.at(k) < vec.at(i) + vec.at(j)) && vec.at(i) != vec.at(j) && vec.at(j) != vec.at(k)&& vec.at(k) != vec.at(i))
                count++;
        }
      
     }
       
	}
  cout << count << endl;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x,y) for(ll i=x;i<=y;i++)
#define imin INT_MIN
#define imax INT_MAX
int mod =1e9+7;
//~ vector<bool> cats;

//~ ll ans;
//~ ll n,m;
//~ void dfs(vector<vector<int>>& graph,int s,int consCats,int parent){
	//~ if(consCats>m) return;
	//~ if(graph[s].size()==1 && graph[s][0]==parent)
	//~ {
		//~ if(cats[s]) consCats++;
		//~ if(consCats<=m) ans++;
		//~ return;
	//~ }
	//~ if(!cats[s]) consCats=0;
	//~ else consCats++;
	//~ for(auto val:graph[s]){
		//~ if(val!=parent)
		//~ dfs(graph,val,consCats,s);
	//~ }


int main(){
	cin.tie(NULL);
    ios_base::sync_with_stdio();

	ll n;
	cin>>n;
	vector<int> a(n);
	
	rep(i,0,n-1) cin>>a[i];
	sort(a.begin(),a.end());
	ll ans=0;
	int i=0;
	while(i<n-2){
		int j=i+1;
		int outer=0;
		
		while(j<n-1){
			int local=0;
			if(a[j]!=a[i])
			rep(k,j+1,n-1){
				if(a[k]!=a[j])
					if(a[i]+a[j]>a[k])
					local++;
			}
			int tmp=a[j];
			while(j<n-1 && a[j]==tmp) { 
				outer+=local;
				j++;
			}
		}
		int tmp=a[i];
		while(i<n-2 && a[i]==tmp){
		ans+=outer;
		i++;}
	}
	cout<<ans;
	
	return 0;
}
