#include <bits/stdc++.h>

using namespace std;
const int N = 1110;

int n, a[N];

int main() {
	cin >> n; int cnt = 0;
	for(int i = 1;i <= n; ++i)
		cin >> a[i];
	sort(a + 1, a + 1 + n);
	for(int i = 1;i <= n; ++i) 
		for(int j = i + 1;j <= n; ++j)
			for(int k = j + 1;k <= n; ++k)
				if(a[i] != a[k] && a[j] != a[k] && a[i] != a[j] && (a[i] + a[j] > a[k]))
					cnt++;
	cout << cnt << endl;
	return 0;
}