import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

void main() {
	auto n = readln.chomp.to!int;
	auto l = readln.chomp.split(' ').map!(to!int).array;
	long count;

	foreach (i;0..n - 2) {
		foreach (j;i + 1..n - 1) {
			foreach (k;j + 1..n) {
				auto large = max(l[i], l[j], l[k]);
				auto small = min(l[i], l[j], l[k]);
				auto middle = cast(int)(cast(long)l[i] + l[j] + l[k] - large - small);

				if (large != middle && middle != small && large < small + middle) {
					++count;
				}
			}
		}
	}

	count.writeln;
}
