function Main(input) {
  let [first, data] = input.trim().split("\n");

  let N = Number(first);
  const arr = [];
  let rst = 0;
  if (first < 3) {
    console.log(0);
  } else {
    data = data.split(" ").map(Number);
    dfs(0, 0);
    console.log(rst);
  }

  function dfs(idx, cnt) {
    if (cnt === 3) {
      const a = data[arr[0]];
      const b = data[arr[1]];
      const c = data[arr[2]];

      if (a !== b && a !== c && b !== c) {
        const [aa, bb, cc] = [a, b, c].sort((a, b) => b - a);
        //삼각혀으이 성립조건
        if (aa < bb + cc) {
          rst++;
        }
      }
      return;
    }

    for (let i = idx; i < N; i++) {
      arr.push(i);
      dfs(i + 1, cnt + 1);
      arr.pop();
    }
  }
}

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