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

int main()
{
	int n; cin >> n;
	ll a[n+1], ans = 0;
	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[k] && (a[i] != a[j]) && (a[i] != a[k]) && (a[j] != a[k])) ans++;
			}
		}
	}
	cout << ans;

    return 0;
}
