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):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    count = 0

    for i in range(N-2):
        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]:
                    count += 1

    print(count)


if __name__ == '__main__':
    main()

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

for i in range(len(l)):
    for j in range(i + 1, len(l)):
        for k in range(j + 1, len(l)):
            sum = l[i] + l[j] + l[k]
            if sum - max(l[i], l[j], l[k]) > max(l[i], l[j], l[k]):
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    t += 1

print(t)

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

count=0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            li=l_list[i]
            lj=l_list[j]
            lk=l_list[k]
            if li!=lj and li!=lk and lj!=lk:
                if lk<li+lj:
                    count+=1
            
print(count)

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

res = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if lens[i] == lens[j]:
            continue
        for k in range(j + 1, n):
            if lens[i] == lens[k] or lens[j] == lens[k]:
                continue
            if lens[i] < lens[j] + lens[k]:
                res += 1

print(res)

Solution (Python):
n=int(input())
if n<3:
  print(0)
else:
  L=[int(i) for i in input().split()]
  x=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] or L[j]==L[k] or L[k]==L[i]:
          pass
        elif L[i]+L[j]>L[k] and L[i]+L[k]>L[j] and L[j]+L[k]>L[i]:
          x+=1
        else:
          pass
  print(x)

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
 
ans = 0
if(N >= 3):
  t = []
  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[i] != L[k]) & (L[j] != L[k]) & (abs(L[j]-L[k]) < L[i]) & (L[i] < L[j]+L[k])): t.append((L[i], L[j], L[k]))
  ans = len(t)

print(ans)

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

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

from itertools import combinations

cnt = 0
for i in combinations(L, 3):
    longest = max(i)
    rest = sum(i) - max(i)
    if longest < rest and i[0] != i[1] and i[0] != i[2] and i[1] != i[2] :
        cnt += 1
print(cnt)

Solution (Python):
import math

n = int(input())
s = list(map(int, input().split()))
s.sort()

cnt = 0
for i in range(n-2):
    for j in range(i, n-1):
        for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1

print(cnt)

Solution (Python):
n = int(input())
a = [int(i) for i in 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 a[i] < a[j] + a[k] and a[j] < a[i] + a[k] and a[k] < a[j] + a[i] and (a[i]!=a[j]) and (a[j]!=a[k] and a[i]!=a[k]):
                ans+=1
                
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int, input().split()))
num = 0
for i,h,j in itertools.combinations(l,3):
    if i+h>j and h+j>i and j+i>h and j!=i and i!=h and h!=j:
        num += 1
print(num)

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

for i in range(0, 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]:
                                        c += 1

print(c)

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

Solution (Python):
N=int(input())
sides=[int(x) for x in input().split()]
counter=0
for i in range(N-2):
	for j in range(i+1,N-1):
		for k in range(j+1,N):
			A=sorted([sides[i],sides[j],sides[k]])
			if (A[0]+A[1]>A[2]) and A[0]!=A[1] and A[1]!=A[2] and A[0]!=A[2]:
				counter+=1
				
print(counter)

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

count=0

if len(L)<3:
    Lis=[]
else:
    Lis=list(itertools.combinations(L,3))
 
numb=len(Lis)

for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            
            count+=1
 
print(count)

Solution (Python):
import itertools
import sys

N = int(input())
s = input().rstrip().split(' ')
L = [int(j) for j in s]

if len(L) < 3:
    print(0)
    sys.exit()

ans = 0

for i,j,k in itertools.combinations(L,3):
    if (i == j) or (i == k) or (j == k): continue
    if (i < j+k) and (j < i+k) and (k < i+j):
        ans += 1

print(ans)

Solution (Python):
n=int(input())
s=list(map(int,input().split()))
ans=0
s.sort()
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if s[i]!=s[j]!=s[k]:
        if s[k]<s[j]+s[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):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

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

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
result = 0
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[i] != a[k] and a[j] != a[k]:
                if a[i] + a[j] > a[k] and a[i] + a[k] > a[j] and a[j] + a[k] > a[i]:
                    result += 1
print(result)

Solution (Python):
def check(a,b,c):
	if a==b or a==c or b==c:
		return False
	if a+b>c and b+c>a and c+a>b:
		
		return True
	return False

n=int(input())
c=list(map(int,input().split()))
count=0
for i in range(len(c)-2):
	for j in range(i+1,len(c)-1):
		for k in range(j+1,len(c)):
			if check(c[i],c[j],c[k]):
				count+=1
print(count)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
cnt = 0
for i in range(n-2):
  l1 = l[i]
  for j in range(i+1, n-1):
    l2 = l[j]
    for g in range(j+1, n):
      l3 = l[g]
      l1_, l2_, l3_ = sorted([l1, l2, l3])
      if l1_ == l2_ or l2_ == l3_:
        continue
      if l3_ < l2_ + l1_:
        cnt += 1
        
print(cnt)

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

print(a)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
 
ans=0
for i in range(0,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[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                    ans+=1
 
print(ans)

Solution (Python):
N = int(input())
L = [int(l) for l in input().split(" ")]

def solve():
  ans = 0
  if len(L) < 3:
    return 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]:
          d = {i: L[i], j:L[j], k:L[k]}
          max_idx = max(d, key=lambda x: d[x])
          if sum(d.values()) - 2*L[max_idx] > 0:
            ans += 1
  return ans

print(solve())

Solution (Python):
from itertools import *
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i,j,k in combinations(a,3):
    if i<j<k and i+j>k:
      ans+=1
print(ans)

Solution (Python):
from itertools import combinations
N = int(input())
L = sorted(map(int, input().split()))
ans = 0
for a, b, c in combinations(L, 3):
    if a < b < c and a + b > c:
        ans += 1
print(ans)

Solution (Python):
import bisect

N = int(input())
Llist = list(map(int, input().split()))
Llist.sort()

cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        if Llist[i] == Llist[j]:
            continue

        res = Llist[j+1:]
        while Llist[j] in res:
            res.pop(0)
        l = Llist[i] + Llist[j]
        cnt += bisect.bisect_left(res, l)

print(cnt)

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

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

M = []
for a in range(N):
  for b in range(a+1,N):
    for c in range(b+1,N):
      if L[a]+L[b]>L[c] and L[a]+L[c]>L[b] and L[b]+L[c]>L[a] \
      and L[a] != L[b] and L[a] != L[c] and L[b] != L[c]:
        M.append((a,b,c))

print(len(M))

Solution (Python):
import sys; input = sys.stdin.readline
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] or lis[j] == lis[k] or lis[i] == lis[k]: continue
			s = sorted([lis[i], lis[j], lis[k]])
			if s[2] < s[1] + s[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+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[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                    ans+=1

print(ans)

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

Solution (Python):
petern = 0
n = input()
Ln = input()
L = list(map(int, Ln.split(' ')))
for i in range(0, len(L)) :
    moji1 = L[i]
    for j in range(i+1, len(L)):
        moji2 = L[j]
        for k in range(j+1, len(L)):
            moji3 = L[k]
            if moji1 != moji2 and moji2 != moji3 and moji3 != moji1 :
                if moji1+moji2 > moji3 and moji2+moji3 > moji1 and moji3+moji1 > moji2 :
                    petern += 1
print(petern)

Solution (Python):
N=int(input())
l=list(map(int, input().split()))
s=0
for i in range(N):
  for j in range(N):
    for k in range(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[i]+l[k] and l[k]<l[i]+l[j]:
        s+=1
print(int(s/6))

Solution (Python):
from itertools import combinations
def triangle(l_tuple):
  if len(set(l_tuple)) == 3:
    if l_tuple[0] + l_tuple[1] > l_tuple[2] and l_tuple[1] + l_tuple[2] > l_tuple[0] and l_tuple[2] + l_tuple[0] > l_tuple[1]:
      return True
  return False
n = int(input())
l = list(map(int, input().split()))
l_comb = list(combinations(l, 3))
cnt = 0
for i in l_comb:
  if triangle(i):
    cnt += 1
print(cnt)

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

Solution (Python):
from itertools import combinations

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

cnt = 0
for edges in list(combinations(L, 3)):
  if len(set(edges)) != 3:
    continue
  
  e1 = edges[0] < edges[1] + edges[2]
  e2 = edges[1] < edges[0] + edges[2]
  e3 = edges[2] < edges[0] + edges[1]
  
  if e1 and e2  and e3:
    cnt += 1

print(cnt)

Solution (Python):
N = int(input())
L = sorted([int(i) for i in input().split()], 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 L[i] < 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()))
L.sort()
count = 0


len = len(L)

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

print(count)

Solution (Python):
import itertools

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

comb = itertools.combinations(L, 3)

ans = 0

for i in comb:
    i = list(i)
    i.sort()
    
    if i[0] + i[1] > i[2] and (i[0] != i[1] and i[1] != i[2] and i[2] != i[0]):
        ans += 1
    
print(ans)

Solution (Python):


N = int(input())
L = list(int(x) for x in 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[i] == L[k] or L[j] == L[k]:
                continue
            if L[i] + L[j] > L[k]:
                ans += 1

print(ans)

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

L = sorted(L)

ans = 0

if N < 3:
   print(ans)
   exit()

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[i] != L[j] and L[j] != L[k]:
            ans += 1

print(ans)

Solution (Python):
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
ed = []
for i in range(n):
    for j in range(i):
        for k in range(j):
            if (l[k] != l[j] and l[i] != l[j] and l[k] + l[j] > l[i]):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):
      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 itertools

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
    if i[0] + i[1] > i[2] and i[0] + i[2] > i[1] and i[2] + i[1] > i[0] and i[0] != i[1] != i[2]:
        count += 1
print(count)

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

L.sort()
cnt = 0

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

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):
            a, b, c = L[i], L[j], L[k]
            if a==b or a==c or b==c: continue
            if a+b > c and a+c > b and b+c > a:
                ans += 1

print(ans)

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

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

print(count)

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

ans = 0

L.sort() 

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            L1 = L[i]
            L2 = L[j]
            L3 = L[k]
            if L1 == L2 or L2 == L3 or L3 == L1:
                continue
            if L1 + L2 > L3:
                ans += 1
            else:
                break

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

Solution (Python):
N=int(input())
array=list(map(int,input().split()))
array1=sorted(array)
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list1[n][0]!=list1[n][1] and list1[n][1]!=list1[n][2]:
    if list1[n][0]+list1[n][1]>list1[n][2]:
      ans=ans+1
print(ans)

Solution (Python):
N=int(input())
array=list(map(int,input().split()))
array1=sorted(array)
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list1[n][0]!=list1[n][1] and list1[n][1]!=list1[n][2]:
    if list1[n][0]+list1[n][1]>list1[n][2]:
      ans=ans+1
print(ans)

Solution (Python):
import itertools
n = int(input())
data = list(map(int, input().split()))
data1=sorted(data)
a = list(itertools.combinations(data1,3))
ans=0
for m in range(len(a)):
  if a[m][0]!=a[m][1] and a[m][1]!=a[m][2]:
    if a[m][0]+a[m][1]>a[m][2]:
      ans=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):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                ans+=0
            elif abs(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()))
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if i < j and j < k:
        if l[i] == l[j]:
          continue
        if l[i] == l[k]:
          continue
        if l[k] == l[j]:
          continue
        if l[i]+l[j]+l[k] <= max(l[i],l[j],l[k])*2:
          continue
        ans += 1
print(ans)

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

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

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] == S[j]:
            continue
        for k in range(j+1, N):
            if S[k] == S[i] or S[j] == S[k]:
                continue
            if S[i]+S[j] > S[k] and S[j]+S[k] > S[i] and S[k]+S[i] > S[j]:
                ans += 1
                
print(ans)

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

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

Solution (Python):
import itertools
n = int(input())
data = list(map(int, input().split()))
a = list(itertools.combinations(data,3))
b = []
for i in range(len(a)):
  a[i] = sorted(a[i])
  if a[i][0] != a[i][1] and a[i][1] != a[i][2] and a[i][2] != a[i][0]:
    if a[i][2] < a[i][0] + a[i][1]:
      b.append(a[i])
print(len(b))

Solution (Python):

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

print(cnt)

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] < 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-2):
  a=L[i]
  for j in range(i+1,n-1):
    b=L[j]
    if a==b:
      continue
    else:
        for k in range(j+1,n):
          c=L[k]
          if a==c or b==c:
            continue
          else:
            if c<a+b and a<b+c and b<c+a:
                ans+=1
print(ans)

Solution (Python):
import sys
n = int(input())
l = list(map(int,input().split()))
counter = 0
if n < 3:
    print(0)
    sys.exit(0)
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            data0 = l[i]
            data1 = l[j]
            data2 = l[k]
            if (data0 != data1) and (data0 != data2) and (data1 != data2):
                if (data0 + data1 + data2 - max(data0,data1,data2)*2) > 0:
                    counter += 1    
print(counter)

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

if n < 3:
    print(0)
    exit()

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

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

print(count)

Solution (Python):
import collections as col
import itertools as iter

n=int(input())
a=list(map(int,input().split()))
ans = 0
for v in iter.combinations(col.Counter(a).items(), 3):
    a, b, c = map(lambda x: x[0], v)
    if a + b > c and b + c > a and c + a > b:
        p, q, r = map(lambda x: x[1], v)
        ans += p * q * r
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):
            if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                if 2*max(L[i],L[j],L[k]) < L[i]+L[j]+L[k]:
                    ans += 1
                
print(ans)

Solution (Python):
N=int(input());ans=0
a=sorted(list(map(int,input().split())))
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())
L = sorted(list(map(int, input().split())))
cnt = 0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[i] != L[j] and L[i] != L[k] and L[j] != L[k] and\
                L[k] + L[j] > L[i]:
                cnt += 1
print(cnt)

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

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
 
sL = sorted(L)
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if sL[i] == sL[j]: continue
        for k in range(j+1, n):
            if (sL[i] == sL[k]) or (sL[j] == sL[k]): continue
            if (sL[i] + sL[j]) > sL[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):
    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] - l[j]
                and l[k] < l[i] + l[j]
            ):
                ans += 1
print(ans)

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

sL = sorted(L)

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

Solution (Python):
import itertools
n=int(input())
l=list(map(int,input().split()))
L=list(itertools.combinations(l,3))
cnt=0
for i in range(len(L)):
  j=0
  ll=L[i]
  for k in range(3):
    if len(set(list(ll)))!=3:
      j+=1
      break
    if abs(ll[k]-ll[(k+1)%3])<ll[(k+2)%3]<ll[k]+ll[(k+1)%3]:
      j=j
    else:
      j+=1
      break
  if j==0:
    cnt+=1
print(cnt)

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

f_side = 0
s_side = 0
t_side = 0

triangle_cnt = 0

if n < 3:
    print(triangle_cnt)
else:
    for first in range(n - 2):
        f_side = l[first]
        for second in range(first+1, n - 1):
            s_side = l[second]
            for third in range(second+1, n - 0):
                t_side = l[third]
                if f_side != s_side and f_side != t_side and s_side != t_side:
                    if f_side+s_side > t_side and s_side+t_side > f_side and f_side+t_side > s_side:
                        triangle_cnt += 1

    print(triangle_cnt)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()
N = len(L)
ans = 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[j] == L[k]:
        continue
      if L[i] + L[j] <= L[k]:
        break
      else:
        ans += 1
print(ans)

Solution (Python):

n = int(input())
a = 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 max(a[i], a[j], a[k]) * 2 < sum([a[i], a[j], a[k]]):
                if a[i] != a[j] and a[i] != a[k] and a[j] != a[k]:
                    cnt += 1
print(cnt)

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 len(set([L[i], L[j], L[k]])) != 3:
                continue
            if not ((L[i] + L[j] > L[k]) and (L[j] + L[k] > L[i]) and (L[k] + L[i] > L[j])):
                continue
            ans += 1
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
import  itertools

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

ans = 0
for v in itertools.combinations(l, 3):
    if v[0] == v[1] or v[1] == v[2]:
        continue
    elif v[2] < v[0]+v[1]: ans+=1

print(ans)

Solution (Python):
n=int(input())
ar=[int(x) for x in input().split()]
ar.sort()

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

print(ans)

Solution (Python):
N = int(input())
arr = [int(n) for n in input().split()]
arr.sort()
res = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      if len({arr[k], arr[i], arr[j]}) == 3 and arr[k] < arr[i] + arr[j]:
        res += 1
print(res)

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

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

Solution (Python):
n = int(input())
if n < 3:
    print(0)
    exit()

lst = [int(n) for n in input().split()]
ct = 0
for i in range(0, n-2):
    for j in range(i+1, n-1): 
        for k in range(j+1, n): 
            l = sorted([lst[i], lst[j], lst[k]])
            if len(set(l)) == 3:
                m = l.pop()
                if m < sum(l):
                    ct += 1
print(ct)

Solution (Python):
N = int(input())
L= sorted(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 len(list(set([L[i], L[j],  L[k]]))) == 3:
      	
        if L[k] < L[i] + L[j]:
          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):
      if (L[i] != L[j]) & (L[j] != L[k]) & (L[k] != L[i]):
        if (L[i] < L[j] + L[k]) & (L[j] < L[i] + L[k]) & (L[k] < L[i] + L[j]) :
          ans += 1
print(ans)

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split()))
L_c = sorted(list(L))
cnt = 0
for i in range(len(L)):
    for j in range(i+1,len(L_c)):
        for l in range(j+1,len(L_c)):
            if L_c[i]!=L_c[j] and L_c[j] !=L_c[l] and L_c[l]<L_c[i] +L_c[j]:
                cnt+=1

print(cnt)

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

Solution (Python):
import itertools
from collections import Counter 

n = int(input())
l = list(map(int,input().split()))
w = set(l)
r = Counter(l)
cnt = 0

for i,j,k in itertools.combinations(w,3):
    if i+j>k and j+k>i and k+i>j:
        cnt += (r[i]*r[j]*r[k])
    
print(cnt)