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 - 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]:
                    M = [L[i], L[j], L[k]]
                    M.sort()
                    if M[2] < M[0] + M[1]:
                        cnt += 1
print(cnt)

Solution (Python):
import itertools as it
n=int(input())
a=sorted(map(int,input().split()))
print(sum(sum(x)>2*x[2]and len(x)==len(set(x))for x in it.combinations(a,3)))

Solution (Python):
import itertools as it
n=int(input())
a=sorted(map(int,input().split()))
print(sum(sum(x)>2*x[2]and len(x)==len(set(x))for x in it.combinations(a, 3)))

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]:
                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()))
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 > c and a + c > b and b + c > a and a != b and a != c and b != c:
        ans += 1
print(ans)

Solution (Python):
import itertools
N=int(input())
L=list(map(int,input().split()))
c=0
if len(L) >=3:
    for v in itertools.combinations(L, 3):
        if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c
else:
    c=0
print(c)

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]:
        continue
      if L[j]==L[k]:
        continue
      if L[i]+L[j] <= L[k]:
        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):
            if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
                xyz=[l[i],l[j],l[k]]
                xyz.sort()
                if xyz[0]+xyz[1]>xyz[2]:
                    ans+=1
print(ans)

Solution (Python):


num = int(input())
count = 0
str = input().split()
table = [int(i) for i in str]

for j in range(num): 
    for k in range(j+1, num): 
        for l in range(k+1, num): 
            if table[j] != table[k] and table[k] != table[l] and table[j] != table[l]:
                len = table[j] + table[k] + table[l] 
                ma = max(table[j], max(table[k], table[l])) 
                rest = len - ma 
                if ma < rest: 
                    count += 1
print(count)

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
c = 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]:
        c += 1
        
print(c)

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

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

print(ans)

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

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

import itertools as it
per = it.combinations(S,r=3)

cnt = 0
for r in per:
  a,b,c = r
  if a ==  b or b == c or a == c:
    continue
    
  if a+b > c and b+c > a and a+c > b:
    
    cnt += 1
    
print(cnt)

Solution (Python):
from itertools import combinations 

N=input()
L=[int(x) for x in input().split()]
comb = combinations(L, 3)
c = 0
for x in comb:
    t=list(x)
    t.sort()
    if t[0]!=t[1] and t[1]!=t[2] and t[0]!=t[2] and t[0]+t[1]>t[2]:
        c += 1
print(c)

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

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

Solution (Python):
n=int(input())
Ns=list(map(int, input().split() ) ) 
ans=0
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      a , b , c = sorted([Ns[i] , Ns[j] , Ns[k]])
      if a+b>c and a!=b and b!=c:
        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):
     
      if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
        if 2*max(l[i], l[j], l[k]) < l[i]+l[j]+l[k]:
          
          ans += 1
print(ans)

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

count = 0

for k in range(N):
    for j in range(N):
        for i in range(N):
            if i>=j or j>=k:
                continue
            l = sorted([L[i], L[j], L[k]])
            if l[0] == l[1] or l[1] == l[2]:
                continue
            if l[2] < l[0] + l[1]:
                count += 1


print(count)

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


if n == 1 or n == 2:
  print(0)
  exit()


len_count = {}
for l in length:
  if l not in len_count:
    len_count[l] = 1
  else:
    len_count[l] += 1

uniq_len = sorted(list(set(length)))
n_len = len(uniq_len)
triangle = []

from itertools import combinations
for c in combinations(uniq_len,3):
  c = sorted(list(c))
  if c[0] + c[1] > c[2]:
    triangle.append(c)
      
ans = 0
for t in triangle:
  ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]]

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):
            _lst = [l[i], l[j], l[k]]

            if len(set(_lst)) == 3:
                _max = max(_lst)
                _lst.remove(_max)
                if _max < sum(_lst):
                    ans += 1

print(ans)

Solution (Python):
N=int(input())
count=0
L=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 L[i]<L[j]+L[k] and L[j]<L[k]+L[i] and L[k]<L[i]+L[j]:
                if L[i]!=L[k] and L[i]!=L[j] and L[k]!=L[j]:
                    count+=1
print(count)

Solution (Python):
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):
    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]:
        count+=1
print(count)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    L = sorted(list(map(int,input().split())))
    ans = 0
    for i in range(n-2):
        for j in range(i,n-1):
            if L[i] == L[j]: 
                continue
            for k in range(j,n):
                if L[j] == L[k]:
                    continue
                if L[i]+L[j] <= L[k]:
                    break
                ans+=1
    print(ans)

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    L = sorted(list(map(int,input().split())))
    ans = 0
    for i in range(n-2):
        for j in range(i,n-1):
            if L[i] == L[j]: 
                continue
            for k in range(j,n):
                if L[j] == L[k]:
                    continue
                if L[i]+L[j] <= L[k]:
                    break
                ans+=1
    print(ans)

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

Solution (Python):
N = int(input())
L = [int(x) for x in input().split()]
L.sort()
cnt = 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)):
            a = L[i]
            b = L[j]
            c = L[k]
            p = a + b > c
            s = a != b
            t = b != c
            if p and s and t:
                cnt += 1
print(cnt)

Solution (Python):
N = int(input())
L = [int(x) for x in input().split()]
cnt = 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)):
            a = L[i]
            b = L[j]
            c = L[k]
            p = a + b > c
            q = b + c > a
            r = c + a > b
            s = a != b
            t = b != c
            u = c != a
            if p and q and r and s and t and u:
                cnt += 1
print(cnt)

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

ans = 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] or L[j] == L[k] or L[k] == L[i]:
                continue
            elif L[i] + L[j] <= L[k] or L[j] + L[k] <= L[i] or L[k] + L[i] <= L[j]:
                continue
            else:
                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):

            edge_list = sorted([L[i], L[j], L[k]])
            if edge_list[0] != edge_list[1] != edge_list[2] and edge_list[2] < edge_list[0] + edge_list[1]:

                ans += 1


print(ans)

Solution (Python):
from itertools import combinations

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

count = 0
for C in combinations(L, 3):
    l_list = list(C)
    l_list.sort()

    if l_list[2] > l_list[1] and l_list[1] > l_list[0]:
        if l_list[2] < l_list[1] + l_list[0]:
            count += 1

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

Solution (Python):
import sys
n = int(sys.stdin.readline().rstrip("\n"))
l = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
l.sort()
ans = 0
for a in range(n):
    for b in range(a+1,n):
        for c in range(b+1,n):
            if l[a] != l[b] and l[b] != l[c] and l[a] != l[c]:
                if l[a] + l[b] > l[c]:
                    ans += 1
print(ans)

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

Solution (Python):
x = input()
N = int(x)
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]:
            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[k] > L[i]) and (L[k] + L[i] > L[j]):
                    count = count + 1

print(count)

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

ans = 0
for i in range(len(ls)-2) :
  a = ls[i]
  for j in range(len(ls)-i-2) :
    b = ls[i+1+j]
    for k in range(len(ls)-i-j-1) :
      c = ls[i+j+k+1]
      if b-a < c < b+a and a!=b!=c!=a :
        ans += 1
print(ans)

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

arr = list(map(int, input().split()))
arr.sort()

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

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

Solution (Python):

n = int(input())
L = list(map(int,input().split()))
l=[]
A=[]
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 and b!=c and c!=a and a+b>c and b+c>a and c+a>b:
                
                
                ans += 1


print(ans)

Solution (Python):
from itertools import combinations as comb
N = int(input())
L = list(map(int,input().split()))
count = 0
for a, b, c in comb(L, 3):
  if a != b and b != c and c != a and 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()))

def judge(l, i, j, k):
  a = l[i]
  b = l[j]
  c = l[k]
  if a != b and b != c and c != a:
    if a + b > c and b + c > a and c + a > b:
      return 1
    else:
      return 0
  else:
    return 0
cnt = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    for k in range(j + 1, n):
      cnt += judge(l, i, j, k)
      
print(cnt)

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

import itertools
cnt = 0
for s, t, u in itertools.combinations(L, 3):
    if (s != t) and (t != u) and (u != s):
        if (s+t > u) and (t+u > s) and (s+u > t):
            cnt += 1

print(cnt)

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

for i in range(len(L)-3+1):
    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[i]+L[k] and L[k]<L[i]+L[j]:
                count += 1

print(count)

Solution (Python):
def resolve():
    
    N = int(input())
    lines = map(int, input().split())
    
    
    
    from itertools import combinations
    count = 0
    for c in combinations(lines, 3):
        if len(set(c)) != 3:
            continue
        if max(c) < sum(c)-max(c):
            count += 1
    print(count)
resolve()

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

Solution (Python):
N = int(input())
L_list = list(map(int,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 = L_list[i]
            b = L_list[j]
            c = L_list[k]
            if a==b or b==c or c==a or a+b<=c or b+c<=a or c+a<=b:
                continue
            counter += 1


print(counter)

Solution (Python):
n = int(input())
l = [int(v) for v in input().split()]
pairs = 0
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        for k in range(j + 1, len(l)):
            a = l[i]
            b = l[j]
            c = l[k]
            if a == b or b == c or c == a:
                continue
            else:
                if a + b <= c or b + c <= a or c + a <= b:
                    continue
                else:
                    pairs += 1
print(pairs)

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


num = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      a = lis[i]
      b = lis[j]
      c = lis[k]
      if a == b or b ==c or c==a:
        continue
      else:
        if a >= b + c or b >= a + c or c >= b + a:
          continue
        else:
          num += 1
print(int(num/6))

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):
n = int(input())
L = list(map(int,input().split()))
print(sum([1 if not(L[i]==L[j] or L[i]==L[k] or L[j]==L[k]) and L[i]+L[j] > L[k] and L[i]+L[k] > L[j] and L[j]+L[k] > L[i] else 0 for i in range(0,n) for j in range(i+1,n) for k in range(j+1,n)]))

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

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

L.sort(reverse = True)
i = j = k = 0
cnt = 0

while i<len(L)-2:
    j = i + 1
    while j<len(L)-1:
        k = j + 1
        if L[i] != L[j]:
            while k<len(L):
                if L[j] != L[k] and L[i] < L[j] + L[k]:
                    cnt += 1
                k += 1
        j += 1
    i += 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 L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                pass
            elif 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):

def main():
    N = int(input())
    L = list(map(int, input().split(" ")))
    cnt = 0
    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]
                l_max = max(l1, l2, l3)
                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if (l1+l2+l3) - l_max <= l_max:
                    continue
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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()))
count = 0
c_list = list(itertools.combinations(l, 3))

for c in c_list:
    if (c[0]+c[1])>c[2] and (c[1]+c[2])>c[0] and (c[2]+c[0])>c[1]:
        if len(set(c)) == 3:
            count += 1

print(count)

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

for ind in ind_list:
    if (l[ind[0]]+l[ind[1]])>l[ind[2]] and (l[ind[1]]+l[ind[2]])>l[ind[0]] and (l[ind[2]]+l[ind[0]])>l[ind[1]]:
        if l[ind[0]]!=l[ind[1]] and l[ind[0]]!=l[ind[2]] and l[ind[1]]!=l[ind[2]]:
            count += 1

print(count)

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

Solution (Python):
def resolve():
    from itertools import combinations
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    if n < 3:
        print(0)
        return

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

    print(ans)

resolve()

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):
            L2=[L[i],L[j],L[k]]
            L2.sort()
            if L2[0]+L2[1]>L2[2] and L2[0] != L2[1] and L2[1] != L2[2] and L2[2] != L2[0]:
                count+=1
                
print(count)

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

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

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

ans = 0
for i1 in range(N):
    for i2 in range(i1, N):
        for i3 in range(i2, N):
            l1 = L[i1]
            l2 = L[i2]
            l3 = L[i3]
            if l1 != l2 and l2 != l3 and l3 != l1:
                if l1 < l2 + l3 and l2 < l3 + l1 and l3 < l1 + l2:
                    ans += 1

print(ans)

Solution (Python):

import itertools

N = int(input().split()[0])
l_list = list(map(int, input().split()))

p_gen = itertools.combinations(range(len(l_list)), 3)
tri_list = []
for pattern in p_gen:
    i, j, k = sorted(list(pattern))
    w_list = sorted([l_list[i], l_list[j], l_list[k]])
    if len(set(w_list)) == 3:
        if w_list[2] < w_list[0] + w_list[1]:
            tri_list.append((i, j, k))
ans = len(tri_list)
print(ans)

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and L[a]!=L[b] and L[a]!=L[c] and L[c]!=L[b] and a<b<c:
                count=count+1
            else:
                continue
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):
      sum_ = sum([l[i], l[j], l[k]])
      max_ = max([l[i], l[j], l[k]])
      if l[i] != l[j] and l[i] != l[k] and l[j] != l[k] and (sum_ - max_) > max_:
        cnt += 1
print(cnt)

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

c = 0
h = set([])

for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      t = [arr[i], arr[j],arr[k]]
      t.sort()
      if t[0] + t[1] > t[2]:
        if t[0]!=t[1]!=t[2]:
          h.add((i,j,k))
          c+=1
        
print(c)

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

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

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

Solution (Python):
def solve(s, count, i, p):
    if count == 3:
        p = list(p.split(":"))
        if int(p[0]) + int(p[1]) > int(p[2]) and int(p[1]) + int(p[2]) > int(p[0]) and int(p[0]) + int(p[2]) > int(p[1]) :
            return 1
        else:
            return 0

    if i == len(s):
        return 0

    if s[i] in p:
        return solve(s, count, i + 1, p)
    else:
        return solve(s, count + 1, i + 1, p + s[i] + ":") + solve(s, count, i + 1, p)


n = int(input())
l = list(input().strip().split(" "))
q = ""
print(solve(l, 0, 0, q))

Solution (Python):
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=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]:
        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(N):
    for k in range(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()))
w = list(set(l))
r = {w[i]:0 for i in range(len(w))}
for i in range(n):
    r[l[i]] += 1
t = list(r.items())
ans = 0
for i in range(len(t)-2):
    for j in range(i+1, len(t)-1):
        for k in range(j+1, len(t)):
            y = sum([t[i][0], t[j][0], t[k][0]])
            x = max([t[i][0], t[j][0], t[k][0]])
            if 2*x < y:
                ans += t[i][1] * t[j][1] * t[k][1]
print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
r = {l[i]:0 for i in range(n)}
for i in range(n):
    r[l[i]] += 1
t = list(r.items())
ans = 0
for i in range(len(t)-2):
    for j in range(i+1, len(t)-1):
        for k in range(j+1, len(t)):
            y = sum([t[i][0], t[j][0], t[k][0]])
            x = max([t[i][0], t[j][0], t[k][0]])
            if 2*x < y:
                ans += t[i][1] * t[j][1] * t[k][1]
print(ans)

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

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

if N <= 2:
    print(0)
    exit()
    
count = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            rod = [L[i], L[j], L[k]]
            condition = set(rod)
            rod = sorted(rod)
            if rod[0] + rod[1] > rod[2] and len(condition) == 3:
                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+1,n):
    for k in range(j+1,n):
      num=[l[i],l[j],l[k]]
      if len(set(num))!=3:continue
      num.sort()
      if num[2]<num[1]+num[0]: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 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 // 6)

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

print(ans)

Solution (Python):
N = int(input())
L = [int(i) for i in input().split()]
cnt = 0

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

Solution (Python):


def judge_tri(a, b, c):
    if a+b>c and b+c>a and c+a>b:
        return True
    else:
        return False

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

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

print(cnt)