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()))

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[k]==l[i] or l[k]==l[j]:
                continue
            if l[k]<l[i]+l[j] and l[i]<l[j]+l[k] and l[j]<l[k]+l[i] :
                count+=1
print(count)

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

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
sum = 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[i] != L[k] and L[j] != L[k] and L[i]+L[j] > L[k] and L[i]+L[k] > L[j] and L[k]+L[j] > L[i]:
                sum += 1
print(sum)

Solution (Python):
from collections import Counter




import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, *l = map(int, read().split())


c = Counter(l)
h = []
for k, v in c.items():
    h.append([k, v])
h.sort()

ans = 0
for i in range(len(h) - 2):
    for j in range(i + 1, len(h) - 1):
        for k in range(j + 1, len(h)):
            if h[k][0] < h[j][0] + h[i][0]:
                ans += h[i][1] * h[j][1] * h[k][1]
print(ans)

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

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

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

n = 0
import sys
if N<3:
    print(0)
    sys.exit()

for i in range(N-2):
    a = A[i]
    for j in range(i+1,N-1):
        if a == A[j]:continue
        b = A[j]
        for k in range(j+1,N):
            if (a == A[k])|(b==A[k]):continue
            c = A[k]
            if (a+b>c)&(b+c>a)&(c+a>b):
                n+=1

print(n)

Solution (Python):
def findNumberOfTriangles(arr, n): 
      
    
    count = 0
      
     
    for i in range(n): 
        for j in range(i + 1, n): 
            for k in range(j + 1, n): 
                if (arr[i] + arr[j] > arr[k] and 
                    arr[i] + arr[k] > arr[j] and 
                    arr[k] + arr[j] > arr[i] and
                    arr[i]!=arr[j] and
                    arr[j]!=arr[k] and
                    arr[i]!=arr[k]): 
                    count += 1
    return count 
  

n=int(input());
arr=list(map(int,input().split()))
  
print(findNumberOfTriangles(arr, n))

Solution (Python):

n=int(input())
hoge=list(map(int,input().split()))
ans=0
for a in range(n):
  for b in range(n-a):
    b+=a
    for c in range(n-b):
      c+=+b
      if(a!=b and b!=c and c!=a):
        if(abs(hoge[a]-hoge[b])<hoge[c] and hoge[c]<hoge[a]+hoge[b] 
           and hoge[a]!=hoge[b] and hoge[b]!=hoge[c] and hoge[c]!=hoge[a]):
          ans+=1
          
print(ans)

Solution (Python):
n = int(input())
l = sorted(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[k] != l[i] and 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())
a = list(map(int,input().split()))

count=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]>a[k] and a[j]+a[k]>a[i] and a[i]+a[k]>a[j]:
                if a[i]!=a[j] and a[i]!=a[k] and a[j]!=a[k]:
                    count+=1

print(count)

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

Solution (Python):
n = int(input())
sticks = list(map(int, input().split()))
sticks.sort()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        li = sticks[i]
        lj = sticks[j]
        if li < lj:
            for k in range(j+1, n):
                lk = sticks[k]
                if lj < lk:
                    if lk >= li +lj:
                        break
                    else:
                        ans += 1
print(ans)

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

L.sort()
count = 0

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

print(count)

Solution (Python):

from itertools import combinations
N = int(input())
L = list(map(int,input().split()))

edges = list(combinations(L,3))

count = 0
for i in edges:
    if i[0] < i[1] + i[2] and i[1] < i[2] + i[0] and i[2] < i[0] + i[1]:
        if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
            count += 1
print(count)

Solution (Python):
from itertools import combinations
n=int(input())
a=list(map(int,input().split()))
c=0
for x in combinations(a,3):
    if x[0]!=x[1] and x[1]!=x[2] and x[2]!=x[0]:
        if x[0]<x[1]+x[2] and x[1]<x[0]+x[2] and x[2]<x[0]+x[1]:
            c+=1
print(c)

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

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

if n >= 3:
    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] > l[k] and l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k]:
                    ans += 1
print(ans)

Solution (Python):
N = int(input())
L = sorted([int(x) for x in input().split()])
def f(i, j, k):
    l, m, n = L[i], L[j], L[k]
    if l == m or m == n:
        return False
    return n < l + m
ans = 0
if len(L) < 3:
    print(0)
    exit()
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            ans += f(i, j, k)
print(ans)

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

count = 0
A.sort()
for i in range(len(A) - 2):
  for j in range(i,len(A)):
    for k in range(j,len(A)):
      if not A[i] == A[j] and not A[i] == A[k] and not A[j] == A[k]:
        if A[k] < A[i]+A[j]:
          count += 1
print(count)

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
            elif 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=list(map(int,input().split()))
L.sort()
count=0
for i in range(N):
    for j in range(N):
        for k in range(N):
            x,y,z=L[i],L[j],L[k]
            if x < y and y < z and x + y > z:
                count+=1
print(count)

Solution (Python):
LI = lambda: list(map(int, input().split()))

N = int(input())
L = LI()


def judge(i, j, k):
    if len(set([L[i], L[j], L[k]])) < 3:
        return False
    a = L[i] + L[j] > L[k]
    b = L[j] + L[k] > L[i]
    c = L[k] + L[i] > L[j]
    if a and b and c:
        return True
    else:
        return False


def main():
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                if judge(i, j, k):
                    ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math

def a():
    s = input()
    if s == 'RRR':
        print(3)
    elif 'RR' in s:
        print(2)
    elif 'R' in s:
        print(1)
    else:
        print(0)


def b():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()
    count = 0
    for i, li in enumerate(l):
        for j, lj in enumerate(l[i + 1:],i + 1):
            for lk in l[j + 1:]:
                if lk < li + lj and li != lj and lj != lk:
                    
                    count += 1
    print(count)




def c():
    pass



def d():
    pass



b()

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 max(L[i],L[j],L[k]) < (sum((L[i],L[j],L[k])) - max(L[i],L[j],L[k])) and L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
        ans += 1
print(ans)

Solution (Python):
import itertools

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

if N>2:
	
	NC=list(itertools.combinations([i for i in range(0,N)],3))
	memo=[]
	memo_=[]
	ans=0
	
	for nc in NC:
		a=L[nc[0]]
		b=L[nc[1]]
		c=L[nc[2]]
		if a!=b and b!=c and c!=a and a+b>c and a+c>b and b+c>a:
			memo.append([L[nc[0]],L[nc[1]],L[nc[2]]])
	
	print(len(memo))

else:
	print(0)

Solution (Python):
import itertools

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

def has_duplicates(seq):
    return len(seq) != len(set(seq))

sides = list(itertools.combinations(L, 3))
count = 0
for side in sides:
    if has_duplicates(side):
        continue
    else:
        temp = sorted(side)
        if temp[1]-temp[0] < temp[2] < temp[0]+temp[1]:
            count += 1

print(count)

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

l=0
for i in range(n-2):
    for j in range(i+1,n-1):
        if m[i]!=m[j]:
            for k in range(j+1,n):
                if m[j]!=m[k] and m[k]!=m[i]:
                    p=0
                    if m[i]+m[j]>m[k]:
                        p+=1
                    if m[i]+m[k]>m[j]:
                        p+=1
                    if m[k]+m[j]>m[i]:
                        p+=1
                    
                    if p==3:
                        l+=1
print(l)

Solution (Python):
import itertools

N = int(input())
A = list(input().split())
B = list(itertools.combinations(A,3))
cnt = 0
for i in B:
  a = int(i[0])
  b = int(i[1])
  c = int(i[2])
  if (a-b)*(b-c)*(c-a) != 0: 
    if a + b > c and b + c > a and c + a > b:
      cnt += 1
print(cnt)

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

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split()))
cnt=0
X = list(itertools.combinations(L,3))
for i in range(len(X)):
    if X[i][0] == X[i][1] or X[i][1] == X[i][2] or X[i][0] == X[i][2]:
        continue
    elif X[i][0] < X[i][1]+X[i][2] and X[i][1] < X[i][0]+X[i][2] and X[i][2] < X[i][1]+X[i][0]:
        cnt += 1
        
print(cnt)

Solution (Python):
from itertools import combinations


def valid_tri(l)->bool:
    if l[0] != l[1] and l[1] != l[2] and l[0] != l[2]:
        
        if l[0] + l[1] > l[2] and l[1] + l[2] > l[0] and l[0] + l[2] > l[1]:
            return True
        else: return False
    else: return False

def main():
    n = int(input())
    l = list(map(int, input().split()))
    cnt = 0
    for l in combinations(l, 3):
        if valid_tri(l):

            cnt += 1

    print(cnt)

if __name__ == "__main__":
    main()

Solution (Python):
import itertools

N = int(input())
L = [int(x) for x in input().split()]

seq = [int(x) for x in range(1,N+1)]
lis = list(itertools.combinations(seq,3))
cnt = 0

for i in lis :
    a = i[0]-1
    b = i[1]-1
    c = i[2]-1
    if L[a] != L[b] and L[b] != L[c] and L[c] != L[a] :
        if L[a] + L[b] > L[c] :
            if L[b]+L[c] > L[a] :
                if L[c] + L[a] > L[b] :
                    cnt += 1

print(cnt)

Solution (Python):



import sys
import glob

class InputGenerator(object):
    def __init__(self, input_path=None):
        if input_path != None:
            self.g = self.input_generator(input_path)
        else:
            self.g = None

    def input_generator(self, input_path):
        with open(input_path) as f:
            for line in f:
                yield line

    def get_input(self):
        if self.g == None:
            return input()
        else:
            return next(self.g)

def triable(a, b, c):
    cond_0 = a != b and a != c and b != c
    cond_1 = a + b > c
    cond_2 = b + c > a
    cond_3 = c + a > b
    return cond_0 and cond_1 and cond_2 and cond_3

def solve(gen):
    N = int(gen.get_input().rstrip())
    len_list = gen.get_input().rstrip().split()
    len_list = list(map(int, len_list))

    
    

    cnt = 0
    for i in range(0, N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                a = len_list[i]
                b = len_list[j]
                c = len_list[k]
                
                
                if triable(a, b, c) == True:
                    cnt += 1
    print(cnt)


if __name__ == '__main__':
    test_flag = len(sys.argv) > 1

    if test_flag == True:
        file_path_list = sorted(glob.glob('test/*'))
    else:
        file_path_list = [None]

    for file_path in file_path_list:
        gen = InputGenerator(file_path)
        solve(gen)

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

L.sort(reverse=True)

count = 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]:
        count += 1

print(count)

Solution (Python):
import sys

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

    
ans=0
for i in range(N):
    for j in range(1,N):
        for z in range(2,N):
            if L[i]!=L[j] and L[j]!=L[z] and L[i]!=L[z]:
                if L[i]<L[j]+L[z] and L[j]<L[i]+L[z] and L[z]<L[j]+L[i]:
                    if i<j and j<z:
                        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,n):
    for k in range(j,n):
      if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
        if abs(l[i] - l[j]) < l[k] < l[i] + l[j]:
          cnt += 1
print(cnt)

Solution (Python):
import itertools

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

com = list(itertools.combinations(list(range(n)), 3))

cnt = 0
for i, j, k in com:
    a = [l[i], l[j], l[k]]
    if len(set(a)) != 3:
        continue
    if sum(a) > 2*max(a):
        cnt += 1
print(cnt)

Solution (Python):
n = int(input())
l = [int(a) for a in input().split()]
l.sort()
count=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] )&( l[i] != l[j] != l[k])):
                count += 1
print(count)

Solution (Python):
N, *L = map(int, open(0).read().split())

count = 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 c == a:
                continue
            if abs(b - c) < a < b + c:
                count += 1

print(count)

Solution (Python):
N = int(input())
L = sorted(list(map(int, input().split())))[::-1]
cnt = 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] + L[k]:
                if L[i] != L[j] != L[k]:
                    cnt += 1
print(cnt)

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


ans = 0
if len(l) < 3:
    print(0)
else:
    prelst = list(itertools.combinations(l,3))

    for lst in prelst:
        lst = sorted(lst)
        if lst[0] + lst[1] > lst[2] and lst[0] != lst[1] != lst[2]:
            ans += 1
    print(ans)

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

result = 0
ind = range(len(L_list))
for i_1 in ind:
  ind_2 = range(i_1 + 1, len(L_list))
  for i_2 in ind_2:
    ind_3 = range(i_2 + 1, len(L_list))
    for i_3 in ind_3:
      if (L_list[i_1] + L_list[i_2] > L_list[i_3]) and (L_list[i_1] + L_list[i_3] > L_list[i_2]) and (L_list[i_3] + L_list[i_2] > L_list[i_1]):
        if (L_list[i_1] != L_list[i_2]) and (L_list[i_3] != L_list[i_2]) and (L_list[i_1] != L_list[i_3]): 
          result += 1
print(result)

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

Solution (Python):
def function(N, L):
    ans = 0
    for i in range(len(L)):
        M = L[len(L)-1-i]
        for j in range(len(L)-i-2):
            for k in range(j+1, len(L)-i-1):
                if not (L[j] == L[k]):
                    if not (M == L[k]):
                        if not (L[j] == M):
                            if L[j]+L[k] > M:
                                ans += 1
    return ans


if __name__ == '__main__':
    N = int(input())
    L = input().split()
    L = [int(i) for i in L]
    L = sorted(L)
    print(function(N, L))

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
count=0
dic = {}
for i in range(len(l)):
    if l[i] in dic:
        dic[l[i]]+=1
    else:
        dic[l[i]]=1
l_set = list(set(l))
m = len(l_set)
for i in range(m-2):
    for j in range(i+1, m-1):
        for k in range(j+1, m):
            x = l_set[i]
            y = l_set[j]
            z = l_set[k]
            if max(x, y, z) < x + y + z - max(x, y, z):
                count+=dic[x]*dic[y]*dic[z]
print(count)

Solution (Python):
import itertools

n=int(input())
c=list(map(int, input().split())) 
c.sort()
ans = 0

for r in itertools.combinations(c, 3):
    if r[0] + r[1] > r[2] and r[0] != r[1] and r[1] != r[2] and r[2] != r[0]:
        ans += 1
        

print(ans)

Solution (Python):
n,*l=map(int,open(0).read().split())
count=0
if n<3:
    print(count)
else:
    import itertools
    for i,j,k in list(itertools.combinations(range(len(l)),3)):
        t=sorted([l[i],l[j],l[k]])
        if len(set(t))==3:
            if t[2]<t[0]+t[1]:
                count+=1
    print(count)

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

n=int(input())
L=list(map(int,input().split()))
L.sort()
count=0
for i in range(n):
    for j in range(i+1,n):
        if L[i]==L[j]:
            continue
        val = L[i]+L[j]
        for k in range(j+1,n):
            if L[k]==L[i] or L[k]==L[j]:
                continue
            if val>L[k]:
                count+=1

print(count)

Solution (Python):
a = int(input())
b = list(map(int, input().split()))
b.sort()

count = 0
for c in b:
    for d in b:
        if c >= d:
            continue
        for e in b:
            if d >= e:
                continue

            if c + d > e and d + e > c and e + c > d:
                count += 1
print(count)

Solution (Python):
import itertools

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

cnt = 0
for pair in itertools.combinations(L, 3):
    t = list(pair)
    t.sort()
    if t[0]==t[1] or t[0] == t[2] or t[1] == t[2]:
        continue
    if t[2] < (t[0] + t[1]):
        cnt +=1

print(cnt)

Solution (Python):
N = int(input())
L_lst = list(map(int,input().split()))
L_lst.sort()
cnt = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for h in range(j + 1, N):
            if L_lst[i] != L_lst[j] and L_lst[j] != L_lst[h] and L_lst[h] != L_lst[i] and (L_lst[i]+L_lst[j])>L_lst[h]:
                cnt += 1
print(cnt)

Solution (Python):
n = int(input())
aa = list(map(int, input().split()))
from collections import Counter

dic = Counter(sorted(aa))
aa = list(dic.keys())

cnt = 0
for i in range(len(aa)-2):
    for j in range(i+1,len(aa)-1):
        for k in range(j+1,len(aa)):
            if (aa[i]+aa[j] > aa[k]):
                cnt += dic[aa[i]] * dic[aa[j]] * dic[aa[k]]
print(cnt)

Solution (Python):
import itertools

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

hen_list = list(itertools.combinations(L, 3))
ans = 0

for i in range(len(hen_list)):
  if len(hen_list[i]) == len(set(hen_list[i])):
    l = sorted(hen_list[i])
    if l[2] < (l[0] + l[1]):
      ans += 1
      
print(ans)

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]:
      s=l[i]+l[j]
      for k in range(j+1,n):
        if l[i]!=l[k] and l[j]!=l[k]:
          if l[k]<s and (l[i]+l[k])>l[j] and (l[j]+l[k])>l[i]:
            count+=1
         
print(count)

Solution (Python):
n = int(input())
if n < 3:
    print(0)
    exit()
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):
            p =[l[i],l[j],l[k]]
            if p[0] == p[1]:
                continue
            if p[0] == p[2]:
                continue
            if p[1] == p[2]:
                continue
            
            if p[0] + p[1] > p[2]:
                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):
            num = [L[i], L[j], L[k]]
            num.sort(reverse=True)
            if num[0] != num[1] and num[0] != num[2] and num[1] != num[2]:
                if num[0] < num[1] + num[2]:
                    ans += 1
print(ans)

Solution (Python):
import itertools

input()

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

ans = 0
for a,b,c in itertools.combinations(l, 3):
    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):
N = int(input())
lis = 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 lis[i] != lis[j] and lis[i] != lis[k] and lis[k] != lis[j] and lis[i] + lis[j] > lis[k] and lis[i] + lis[k] > lis[j] and lis[j] + lis[k] > lis[i]:
                ans += 1
                
print(ans)

Solution (Python):




n = int(input())
l = list(map(int,input().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[k]:
                wkl = list()
                wkl.append(l[i])
                wkl.append(l[j])
                wkl.append(l[k])
                wkl.sort()
                if wkl[0] + wkl[1] > wkl[2]:
                    cnt = cnt + 1


print(cnt)

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

ans=0
for pair in itertools.combinations(l,3):
    pair=list(pair)
    pair.sort()
    
    if pair[0]+pair[1]>pair[2]>abs(pair[0]-pair[1]) and pair[0]!=pair[1]!=pair[2]:
        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[k]:
              if l[i] + l[j] > l[k] and  l[k] + l[j] > l[i] and  l[i] < l[j] + l[k]:
                ans += 1
print(ans)

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))

    l = sorted(l)[::-1]
    count = 0
    ans = [(l[i], l[j], l[k]) 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] + l[k] and l[j] < l[i] + l[k] and l[k] < l[i] + l[j]
               and not l[i] == l[j] and not l[i] == l[k] and not l[j] == l[k]]
    print(len(ans))

Solution (Python):


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):
            a = ls[i]
            b = ls[j]
            c = ls[k]

            nums = [a,b,c]
            nums.sort()

            maxi = nums[2]
            mid = nums[1]
            mini = nums[0]

            if maxi < mid + mini and maxi != mid and mid != mini:
                ans += 1

print(ans)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
total = 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[k]:
                if l[i]+l[j] > l[k]:
                    total += 1
print(total)

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

import itertools
comb = itertools.combinations(L, 3)
ans = 0
for c in comb:
  if len(set(c)) !=3:
    continue
  tmp = sorted(c)
  if tmp[2] < tmp[1] + tmp[0]:
    ans +=1
print(ans)

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

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

print(ans)

Solution (Python):
n = int(input())
l = input().split()
for i in range(n):
    l[i] = int(l[i])
l.sort()

c = 0
if n < 3:
    print(0)
else:
    for i in range(len(l)-2):
        x = l[i]
        for j in range(i+1, len(l)-1):
            y = l[j]
            for k in range(j+1, len(l)):
                z = l[k]
                if x != y and y != z and z != x:
                    if x + y > z and y + z > x and z + x > y:
                        c += 1
    print(c)

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

count = 0
for i in itertools.combinations(range(N), 3):
    Lx = sorted([L[i[0]], L[i[1]], L[i[2]]])
    if not (Lx[0] == Lx[1] or Lx[1] == Lx[2] or Lx[2] == Lx[0]):
        if Lx[0] + Lx[1] > Lx[2] :
            count += 1
    
print(count)

Solution (Python):
import collections
N=int(input())
L=list(map(int,input().split()))
ans=0
for i in range(N):
    for j in range(i+1,N):
        for h in range(j+1,N):
            A=L[i]
            B=L[j]
            C=L[h]
            if abs(A-B)<C<A+B and A!=B and B!=C and C!=A:
                ans+=1
print(ans)

Solution (Python):
import itertools
N=int(input())
L=list(map(int,input().split()))
d=list(itertools.combinations(L,3))
count=0
for i in range(len(d)):
  a=d[i][0]
  b=d[i][1]
  c=d[i][2]
  if a==b or b==c or c==a:
    continue
  elif a+b>c and b+c>a and c+a>b:
      count+=1
      
print(count)

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

ans = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if i != j and (j != k and k != i):
                if l[i] != l[j] and (l[j] != l[k] and l[k] != l[i]):  
                    abc = []
                    abc.append(l[i])
                    abc.append(l[j])
                    abc.append(l[k])
                    abc.sort()
                    if abc[0] + abc[1] > abc[2]:
                        ans += 1
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
combi = itertools.combinations(list(range(n)),3)
ans = 0

for i in combi:
    l_1 = [l[i[0]],l[i[1]],l[i[2]]]
    l_1.sort()
    flag_1 = l_1[0]+l_1[1]>l_1[2] and l_1[1]+l_1[2]>l_1[0] and l_1[0]+l_1[2]>l_1[1]
    flag_2 = l_1[0] != l_1[1] and l_1[1] != l_1[2] and l_1[0] != l_1[2]
    if flag_1 and flag_2:
        ans += 1

print(ans)

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

import itertools

out = 0

for a, b, c in itertools.combinations(L, 3):
    if a != b and b != c and a != c and a + b + c > 2 * max(a,b,c):
        out += 1

print(out)

Solution (Python):
from itertools import combinations
n = int(input())
arr = list(map(int, input().split()))
count = 0
for i, j, k in combinations(arr, 3):
    if i == j or j == k or k == i:
        continue
    elif (i + j) > k and (j + k) > i and (k + i) > j:
        count += 1
print(count)

Solution (Python):
import itertools
N = int(input())
L = list(map(int,input().split()))
ans = 0
for i in itertools.combinations(L, 3):
    
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
        if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
            ans += 1
print(ans)

Solution (Python):
n=int(input())
li=list(map(int,input().split()))
li.sort(reverse=True)
ans=0

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