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

long long n, a[N], ans;

int main() {
	cin>>n;
	for (int i=0; i<n; i++) cin>>a[i];
	sort(a, a+n);
	
	for (int i=0; i<n; i++) {
		for (int j=i+1; j<n; j++) {
			for (int k=j+1; k<n; k++) {
				if (a[i] == a[j] || a[j] == a[k]) continue;
				if (a[i]+a[j] > a[k]) ans++;
			}
		}
	}
	
	cout<<ans<<endl;
}