function Main(input) {
	const col = input.split("\n");
	const row = col[1].split(" ");
	let list = row.filter((x, i, self) => self.indexOf(x) === i);

	if(list.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);
		}
		let list2 = [];
		for(let s=0; s < list.length; s++){
			list2.push(parseInt(list[s], 10));
		}
		let cnt = 0;
		for(let i=0; i < list2.length-2; i++){
			for(let j=i+1; j < list2.length-1; j++){
				for(let k=j+1; k < list2.length; k++){
					if(triangle(list2[i],list2[j],list2[k])) cnt++;
				}
			}
		}
		
		console.log(cnt);
	}
};

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