Problem:
 Score : 200 points    Problem Statement We have sticks numbered 1, \cdots, N . The length of Stick i  (1 \leq i \leq N) is L_i .  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k)  (1 \leq i < j < k \leq N) that satisfy both of the following conditions:   L_i , L_j , and L_k are all different.  There exists a triangle whose sides have lengths L_i , L_j , and L_k .       Constraints  1 \leq N \leq 100  1 \leq L_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  L_1  L_2  \cdots  L_N       Output Print the number of ways to choose three of the sticks with different lengths that can form a triangle.        Sample Input 1 5
4 4 9 7 5      Sample Output 1 5  The following five triples (i, j, k) satisfy the conditions: (1, 3, 4) , (1, 4, 5) , (2, 3, 4) , (2, 4, 5) , and (3, 4, 5) .       Sample Input 2 6
4 5 4 3 3 5      Sample Output 2 8  We have two sticks for each of the lengths 3 , 4 , and 5 . To satisfy the first condition, we have to choose one from each length.  There is a triangle whose sides have lengths 3 , 4 , and 5 , so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.       Sample Input 3 10
9 4 6 1 9 6 10 6 6 8      Sample Output 3 39       Sample Input 4 2
1 1      Sample Output 4 0  No triple (i, j, k) satisfies 1 \leq i < j < k \leq N , so we should print 0 .

Solution (Python):
n = int(input())
l = list(map(int, input().split()))

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a == b or b == c or c == a:
                continue
            if a + b > c and b + c > a and c + a > b:
                cnt += 1

print(cnt)

Solution (Python):
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] < l[j] < l[k] and l[k] < l[i] + l[j]:
                ans += 1
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
cnt = 0
for i in itertools.combinations(l,3):
  if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
    if (sum(i)-max(i)) > max(i):
      cnt += 1
print(cnt)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

ans = 0

for i in range(N - 2):
  for j in range(i + 1, N - 1):
    for k in range(j + 1, N):
      ii = L[i]
      jj = L[j]
      kk = L[k]
      if ii == jj: continue
      if jj == kk: continue
      if kk == ii: continue
      if ii + jj <= kk: continue
      if jj + kk <= ii: continue
      if kk + ii <= jj: continue
      ans += 1

print(ans)

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
l = lr()
l.sort()
ans = 0
for i in range(n-2):
    a = l[i]
    for j in range(i+1, n-1):
        b = l[j]
        for k in range(j+1, n):
            c = l[k]
            if a != b and b != c and c != a and c < a+b:
                ans+=1
print(ans)

Solution (Python):
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    L = list(map(int,input().split()))

    L.sort()
    count=0
    for i in range(N-2):
        for j in range(i+1,N-1):
            if L[i] ==L[j]:
                continue

            for k in range(j+1,N):
                if L[i] +L[j] >L[k] and L[j] != L[k]:
                    count+=1

    print(count)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and L[i] + L[j] + L[k] > 2 * max(L[i], L[j], L[k]):
                ans += 1
                

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[j] and L[i] + L[j] > L[k]:
                ans += 1
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
cnt=0

for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if l[i]+l[j]>l[k] and l[i]!=l[j] and l[i]!=l[k] and l[k]!=l[j]:
                cnt+=1
print(cnt)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if a[i]!=a[j] and a[j]!=a[k]:
        if a[i]+a[j]>a[k]:
          ans+=1
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for a in range(j+1,n):
      if l[i]+l[j]>l[a] and l[i]!=l[j] and l[j]!=l[a]:
        ans+=1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            b = [L[i], L[j], L[k]]
            b.sort()
            if b[0] == b[1]:
                continue
            if b[1] == b[2]:
                continue
            if b[0]+b[1] > b[2]:
                cnt += 1

print(cnt)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k] and l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[i] + l[k] > l[j]:
                ans += 1
print(ans)

Solution (Python):
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    for i in range(N):
        for j in range(i + 1, N):
            if A[i] == A[j]:
                continue
            for k in range(j + 1, N):
                if A[i] == A[k] or A[j] == A[k]:
                    continue
                if A[i] + A[j] > A[k] and A[j] + A[k] > A[i] and A[k] + A[i] > A[j]:
                    count += 1
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
l = list(map(int, input().split()))


ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            a = l[i], l[j], l[k]
            a = sorted(a, reverse=True)
            if a[0] == a[1] or a[1] == a[2]:
                continue
            if a[0] < a[1] + a[2]:
                ans += 1
print(ans)

Solution (Python):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
L=[int(i) for i in input().split()]
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      A=[L[i],L[j],L[k]]
      A.sort()
      a,b,c=A
      if a<b<c and c<a+b:
        ans+=1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

N=int(input())
L=list(map(int,input().split()))

L.sort()

ANS=0

for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]==L[j] or L[j]==L[k]:
                continue
            if L[i]+L[j]>L[k]:
                ANS+=1

print(ANS)

Solution (Python):
N = int(input())
A = [int(a) for a in input().split()]
ans = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if abs(A[i] - A[j]) < A[k] < A[i] + A[j] and A[i] != A[j] and A[j] != A[k] and A[k] != A[i]:
                ans += 1
print(ans)

Solution (Python):
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()


n = int(ri())
a = Ri()
ans = 0
a.sort()
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if a[i] != a[j] and a[j] != a[k] and a[i] + a[j] > a[k]:
                ans+=1
print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      b = [a[i],a[j],a[k]]
      b.sort()
      if b[0] == b[1] or b[1] == b[2]:
        pass
      elif b[0] + b[1] > b[2]:
        ans += 1
print(ans)

Solution (Python):
N=int(input())
L=list(map(int,input().split()))

ans=0
for i in range(N):
    a=L[i]
    for j in range(i+1,N):
        b=L[j]
        for k in range(j+1,N):
            c=L[k]
            if a!=b and b!=c and c!=a:
                if abs(a-b)<c and c<a+b:
                    ans+=1
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      a=l[i]
      b=l[j]
      c=l[k]
      if a==b or b==c or a==c:
        continue
      t=[a,b,c]
      t.sort()
      if t[0]+t[1]>t[2]:
        ans+=1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline



def main():
    n = int(input().strip())
    L = sorted([int(i) for i in input().strip().split()])
    cnt = 0
    for i in range(0, n - 2):
        for j in range(i + 1, n - 1):
            for k in range(j + 1, n):
                if L[i] < L[j] and L[j] < L[k] and L[i] + L[j] > L[k]:
                    cnt += 1
    print(cnt)
    return


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

L.sort()


ans = 0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      a,b,c = L[i], L[j], L[k]
      if a==b or b == c or c == a:
        continue
      if a+b > c:
        ans += 1
        
print(ans)

Solution (Python):
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

yes = "Yes"
no = "No"


def main():
    n = ii()
    l = li()
    cnt = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                    continue
                if l[i] + l[j] <= l[k] or l[i] + l[k] <= l[
                        j] or l[k] + l[j] <= l[i]:
                    continue
                cnt += 1
    print(cnt)


main()

Solution (Python):
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                if l[i] + l[j] > l[k] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                    ans += 1

print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[k] < l[i] + l[j] and l[i]!=l[j] and l[j]!=l[k]:
                ans += 1
print(ans)

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = L[i], L[j], L[k]
            if a==b or b==c or c==a:
                continue
            if a+b>c and b+c>a and c+a>b:
                ans += 1
print(ans)

Solution (Python):
import sys, math
import io, os

from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write('\n'.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
from fractions import Fraction

INF = float('inf')
mod = int(1e9)+7


n=int(data())
l=mdata()
l.sort()
ans=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k] and l[i]+l[j]>l[k]:
                ans+=1
out(ans)

Solution (Python):

from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import bisect
import math
import fractions
import sys
import copy


def L(): return sys.stdin.readline().split()


def I(): return int(sys.stdin.readline().rstrip())


def SL(): return list(sys.stdin.readline().rstrip())


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def IR(n): return [I() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def LIR1(n): return [LI1() for _ in range(n)]


def SR(n): return [SL() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def LR(n): return [L() for _ in range(n)]


def perm(n, r): return math.factorial(n) // math.factorial(r)


def comb(n, r): return math.factorial(
    n) // (math.factorial(r) * math.factorial(n-r))


alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007
INF = float("inf")


def main():
    N = I()
    L = LI()

    ans = 0
    for (a, b, c) in itertools.combinations(L, 3):
        if a < b + c and abs(b - c) < a and a != b and b != c and a != c:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 19 + 7
EPS = 10 ** -10

N = INT()
A = LIST()

A.sort()
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a, b, c = A[i], A[j], A[k]
            if a == b or b == c or c == a:
                continue
            if a+b > c:
                ans += 1
print(ans)

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, L):
    L.sort()
    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                if L[i] != L[j] and L[j] != L[k] and L[i] != L[k] and L[i] + L[j] > L[k]:
                    ans += 1
    return ans


def main():
    N = read_int()
    L = read_int_n()
    print(slv(N, L))


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())


L = list(map(int, input().split()))

count = 0
for i in range(N):
  for j in range(i + 1, N):
    if L[i] != L[j]:
      for k in range(j + 1, N):
        if (L[i] != L[k]) and (L[j] != L[k]):
          m = L[i] + L[j] + L[k]
          s = max(L[i] , L[j] , L[k])
          if s < m - s:
            count += 1

print(count)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

L.sort()

ans = 0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if L[i] < L[j] < L[k] and L[k] < L[i] + L[j]:
        ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if L[i] != L[j] and L[j] != L[k] and L[i] + L[j] > L[k]:
                ans += 1
                
print(ans)

Solution (Python):
n = int(input())
l = sorted(list(map(int, input().split())))

res = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if l[i] != l[j] != l[k] and l[i] + l[j] > l[k]:
                res += 1

print(res)

Solution (Python):
n=int(input())
l=list(map(int, input().split()))
l.sort()
cnt=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]<l[j] and l[j]<l[k]:
        if l[i]+l[j]>l[k]:
          cnt+=1
print(cnt)

Solution (Python):
n = int(input())
dat = list(map(int, input().split()))
dat.sort()





res = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j + 1, n):
            a,b,c = dat[i], dat[j], dat[k]
            if a == b or a == c or b == c:
                continue
            if c < a+b:
                res += 1
print(res)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if l[i]+l[j]>l[k] and l[i]!=l[j] and l[j]!=l[k] and l[i]!=l[k]:
				ans+=1
print(ans)

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
l=sorted(lmp())
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k] and l[i]+l[j]>l[k]:
                ans+=1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a,b,c = l[i],l[j],l[k]
            if a==b or b==c or c==a: continue
            if a<b+c and b<c+a and c<a+b: ans += 1
                
print(ans)

Solution (Python):
from sys import stdin,stdout
for _ in range(1):
    n=int(stdin.readline())
    a=list(map(int,stdin.readline().split()))
    ans=0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                if len(set([a[i],a[j],a[k]]))==3 and a[i]+a[j]>a[k] and a[j]+a[k]>a[i] and a[i]+a[k]>a[j]:ans+=1
    print(ans)

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  L=LI()

  ans=0
  for i in range(N):
    for j in range(i+1,N):
      for k in range(j+1,N):
        a,b,c=sorted([L[i],L[j],L[k]])
        if a!=b and a!=c and b!=c and a+b>c:
          ans+=1

  return ans


print(main())

Solution (Python):
N=int(input())
L=sorted(list(map(int,input().split())))
a=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]!=L[j] and L[j]!=L[k] and L[k]<L[i]+L[j]:
                a+=1
print(a)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    l=LIST()
    l=sorted(l)
    ans=0
    for i in range(n):
        for j in range(i,n):
            for k in range(j,n):
                a=l[i]
                b=l[j]
                c=l[k]
                flg=True
                if a==b or b==c or c==a:
                    flg=False
                if a+b<=c:
                    flg=False
                if flg:
                    ans+=1
                    
    print(ans)
    
if __name__ == '__main__':
    do()

Solution (Python):
n = int(input())
ll = list(map(int, input().split()))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a,b,c = ll[i], ll[j], ll[k]
            if a == b or b == c or c == a:
                continue
            vs = [a,b,c]
            vs.sort()
            if vs[0] + vs[1] > vs[2]: 
                cnt += 1
                

print(cnt)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
        continue
      a,b,c = l[i],l[j],l[k]
      if a+b > c and b+c > a and a+c>b:
        cnt += 1
print (cnt)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    L = [int(l) for l in input().split()]
    count = 0
    if N <= 2: print(0)
    else:
        for i in range(N - 2):
            for j in range(i + 1, N - 1):
                for k in range(j + 1, N):
                    if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                        tri = [L[i], L[j], L[k]]
                        tri.sort()
                        if tri[0] + tri[1] > tri[2]: count += 1
    
        print(count)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

cnt = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[i] + L[k] > L[j]:
                    cnt += 1

print(cnt)

Solution (Python):
n = int(input())
l = sorted(map(int, input().split()))[::-1]

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[k] < l[j] < l[i] and l[k] + l[j] > l[i]:
                ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort()

ans = 0
for i in range(n-2):
    li = l[i]
    for j in range(i+1,n-1):
        lj = l[j]
        for k in range(j+1,n):
            lk = l[k]
            if(li==lj)|(lj==lk):
                continue
            if(li+lj <= lk):
                continue
            ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N-2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            a, b, c = sorted([L[i], L[j], L[k]])
            if a == b or b == c or a == c:
                continue
            if a + b > c:
                ans += 1

print(ans)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    l = list(map(int, readline().split()))

    ans = 0
    for i in range(n):
        a = l[i]
        for j in range(i + 1, n):
            b = l[j]
            if a == b:
                continue
            for k in range(j + 1, n):
                c = l[k]
                if a == c or b == c:
                    continue
                d = [a, b, c]
                d.sort()
                if d[0] + d[1] > d[2]:
                    ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
Ls = list(map(int, input().split()))
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            arr = [Ls[i], Ls[j], Ls[k]]
            arr.sort()
            if arr[0] + arr[1] > arr[2] and arr[0] != arr[1] and arr[1] != arr[2]:
                ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in range(N-2):
	a = L[i]
	for j in range(i+1, N-1):
		b = L[j]
		if a == b:
			continue
		for k in range(j+1, N):
			c = L[k]
			if a == c or b == c:
				continue
			if abs(a-b) < c and c < a+b:
				ans += 1
print(ans)