#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N, ans=0; cin >> N; int L[N];
REP(i, N){ cin >> L[i]; }
REP(i, N){ for(int j=i+1; j<N-1; j++){ for(int k=j+1; k<N; k++){
if(L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i]&&L[i]+L[j]>L[k]&&L[j]+L[k]>L[i]&&L[k]+L[i]>L[j]){ ans++; }
}}}
cout << ans << "\n";
}