#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int N;
  cin>>N;
  vector<int> L(N);
  rep(i,N)cin>>L[i];
  sort(begin(L),end(L));
  
  int ans=0;
  rep(i,N){
    rep(j,i){
      rep(k,j){
        if(L[k]!=L[j]&&L[j]!=L[i]&&L[k]+L[j]>L[i])ans+=1;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}