function Main(input) {
	const col = input.split("\n");
	const row = col[1].split(" ");

	if(row.length < 3){
		console.log(0);
	} else {
		const triangle = function(a, b, c) {
			const check = (d, e ,f) => (d + e) > f;
			return check(a, b, c) && check(b, c, a) && check(c, a, b);
		}
		const diff = (a, b, c) => a !== b && b !== c && c !== a;

		let list = [];
		for(let s=0; s < row.length; s++){
			list.push(parseInt(row[s], 10));
		}
		let cnt = 0;
		for(let i=0; i < list.length-2; i++){
			for(let j=i+1; j < list.length-1; j++){
				for(let k=j+1; k < list.length; k++){
					if(triangle(list[i],list[j],list[k]) && diff(list[i],list[j],list[k])) {
						cnt++;
					}
				}
			}
		}
		
		console.log(cnt);
	}
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
