#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,j,k) for(ll i=j;i<k;i++)


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

