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):
import itertools

n = int(input())
list = list(map(int, input().split()))
list2 = itertools.combinations(list, 3)

ans = 0
for ele in list2:
    a = ele[0]
    b = ele[1]
    c = ele[2]
    if a == b or b == c or c == a:
        continue
    if abs(a-b) < c and c < a+b:
        ans += 1
print(ans)

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

n = int(input())
li = list(map(int,input().split()))
li.sort()
count = 0
for i in range(n-1):
    for j in range(i+1,n-1):
        if li[i] == li[j]:
            continue
        else:
            count += len([k for k in li[j+1:] if k < (li[i] + li[j]) and k != li[i] and k != li[j]])
print(count)

Solution (Python):
def check(x, y, z):
    return x+y > z and x+z > y and y+z > x

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

Solution (Python):
from itertools import *
n,*a=map(int,open(0).read().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):
import itertools
N = int(input())
L = list(map(int,input().split()))
count=0
p_list=list(itertools.combinations(range(N),3))
for i in p_list:
    if((L[i[0]]!=L[i[1]]) and (L[i[2]]!=L[i[1]]) and (L[i[0]]!=L[i[2]]) ):
        if((L[i[0]]+L[i[1]]> L[i[2]]) and (L[i[1]]+L[i[2]]> L[i[0]]) and (L[i[0]]+L[i[2]]> L[i[1]])):
            count+=1
print(count)

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

import itertools
itt = list(itertools.combinations(l, 3))
result = 0
for it in itt:
    if len(set(it)) < 3:
        continue
    else:
        tmp = list(it)
        tmp.sort()
        
        if (tmp[0] + tmp[1] > tmp[2]):
            
            result += 1
print(result)

Solution (Python):
N = int(input())
nums = list(map(int, input().split()))
 
set_nums = sorted(list(set(nums)))
set_dup = set_nums.copy()
 
if N <= 2:
    print(0)
else:
    for i, d in enumerate(set_dup):
        count = 0
        for n in nums:
            if n == d:
                count += 1
        set_dup[i] = count
 
    count = 0
    for a in range(len(set_nums)):
        for b in range(a+1, len(set_nums)):
            for c in range(b+1, len(set_nums)):
                if set_nums[a] + set_nums[b] > set_nums[c]:
                    count += set_dup[a] * set_dup[b] * set_dup[c]
    print(count)

Solution (Python):
n = int(input())
l = [int(ln) for ln in input().split()]
ans = 0
if len(l) >= 3:
  for i in range(n-2):
    li = l[i]
    for j in range(i+1, n-1):
      lj = l[j]
      if not (li == lj):
        for k in range(j+1, n):
          lk = l[k]
          if not(li == lk) and not(lj ==lk):
            if (li + lj > lk) and (lj + lk > li) and (lk + li > lj):
              ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
sticks = {}
for l in L:
  if l in sticks:
    sticks[l] += 1
  else:
    sticks[l] = 1

sticks = sorted(sticks.items(), key=lambda x:x[0])
targetIndexes = [0, 1, 2]
res = 0
while targetIndexes[0] < len(sticks) - 2:
  if abs(sticks[targetIndexes[0]][0] - sticks[targetIndexes[1]][0]) < sticks[targetIndexes[2]][0] < sticks[targetIndexes[0]][0] + sticks[targetIndexes[1]][0]:
    res += sticks[targetIndexes[0]][1] * sticks[targetIndexes[1]][1] * sticks[targetIndexes[2]][1]

  if targetIndexes[2] < len(sticks) - 1:
    targetIndexes[2] += 1
  elif targetIndexes[1] < len(sticks) - 2:
    targetIndexes[1] += 1
    targetIndexes[2] = targetIndexes[1] + 1
  else:
    targetIndexes[0] += 1
    targetIndexes[1] = targetIndexes[0] + 1
    targetIndexes[2] = targetIndexes[1] + 1


print(res)

Solution (Python):
num=int(input().rstrip())
m=list(map(int,input().rstrip().split()))
if num<3:
    count=0
else:
    count=0
    for i in range(num-2):
        for j in range(i+1,num-1):
            for k in range(j+1,num):
                if m[i]==m[j] or m[j]==m[k] or m[k]==m[i]:
                    pass
                elif m[i]<m[j]+m[k] and abs(m[j]-m[k])<m[i]:
                    count+=1
print(count)

Solution (Python):
n = int(input())
L = [*map(int, input().split())]
M = {}
for l in L:
    if l in M:
        M[l] +=1
    else:
        M[l] = 1
M = list(M.items())
M.sort()


m=len(M)
c=0
for i in range(m):
    for j in range(i+1, m):
        for k in range(j+1, m):
            if M[i][0]+M[j][0] > M[k][0]:
                c += M[i][1] * M[j][1] * M[k][1]
                
                

print(c)

Solution (Python):
import sys

def isTriangle(num1, num2, num3):
    if num1 == num2 or num2 == num3 or num3 == num1:
        return False
    if num1 + num2 <= num3 or num1 + num3 <= num2 or num2 + num3 <= num1:
        return False
    return True



n = int(sys.stdin.readline())
line = sys.stdin.readline()

if not "" == line.rstrip():
        nums = line.rstrip().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 isTriangle( int(nums[i]), int(nums[j]), int(nums[k]) ):
                count += 1

print(count)

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

def solve(n, lst):
    count = 0
    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                if lst[i] != lst[j] and lst[j] != lst[k] and lst[i] != lst[k] and check(lst[i], lst[j], lst[k]):
                    count += 1
    return count

n = int(input())
lst = list(map(int, input().split(' ')))
print(solve(n, lst))

Solution (Python):
def main():
    n = int(input())
    l = tuple([int(t)for t in input().split()])

    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                lst = sorted([l[i],l[j],l[k]])
                if len(set(lst))==3:
                    if lst[2] < lst[0]+lst[1]:
                        ans+=1
    
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import itertools

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

C = list(itertools.combinations(li,3))

for i in range(len(C)):
    C[i] = list(C[i])

count = 0

for j in C:
    if j[0] < j[1] + j[2] and j[0] + j[1] > j[2] and j[0] + j[2] > j[1] :
        if j[0] != j[1] and j[1] != j[2] and j[2] != j[0] :
            count += 1

print(count)

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

Solution (Python):
def main():
    n = int(input())
    l = tuple([int(t)for t in input().split()])

    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                lst = sorted([l[i],l[j],l[k]])
                if len(set(lst))==3:
                    if lst[2] < lst[0]+lst[1]:
                        ans+=1
    
    print(ans)

if __name__ == "__main__":
    main()

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


import itertools

cnt = 0

for x in itertools.combinations(l, 3):
    i = x[0]
    j = x[1]
    k = x[2]
    if i == j or j == k or k == i: continue
    if i + j > k and j + k > i and k + i > j:
        cnt += 1

print(cnt)

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

cnt = 0
for i, l1 in enumerate(L):
    for j, l2 in enumerate(L[i+1:]):
        if l1 == l2:
            continue
        for k, l3 in enumerate(L[i+j+2:]):
            if (l2 == l3) or (l1 == l3):
                continue

            if (l1 + l2 > l3) and (l2 + l3 > l1) and (l1 + l3 > l2):
                cnt += 1

print(cnt)

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

import itertools
p = itertools.combinations(L,3)
cnt=0
for v in p:
    if v[0]!=v[1] and v[1]!=v[2] and v[0]!=v[2]:
        if v[0] < v[1]+v[2] and v[1] < v[0]+v[2] and v[2] < v[0]+v[1]:
            cnt+=1
print(cnt)

Solution (Python):
import itertools

n = int(input())
ln = [int(num) for num in input().split()]

count = 0
for a, b, c in itertools.combinations(ln, 3):
  if a != b and b != c and c != a:
    if (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()))
count=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]>l[c] and l[a]+l[c]>l[b] and l[c]+l[b]>l[a]:
                if l[a]==l[b] or l[a]==l[c] or l[b]==l[c]:
                    pass
                else:
                    count=count+1
            else:
                pass
print(count)

Solution (Python):
import itertools

N = int(input())
L = list(map(int, input().split()))
count=0
iterL = list(itertools.combinations(L,3))

for LL in iterL:
    if LL[0]==LL[1] or LL[0]==LL[2] or LL[2]==LL[1]:
        continue
    LLL = list(LL)
    LLL = sorted(LLL)

    if LLL[0]+LLL[1]>LLL[2]:
        count+=1

print(count)

Solution (Python):
import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s=reader()
n,l=int(s[0][0]),vfunc(int)(s[1])
print(sum(vfunc(lambda args:((args[0]+args[1])>args[2]) and ((args[0]+args[2])>args[1]) and ((args[1]+args[2])>args[0]))(list(filter(lambda a:a[0]!=a[1] and a[2]!=a[1] and a[0]!=a[2],combinations(l,3))))))

Solution (Python):
import itertools

pair_num = 0
N = int(input())
L_list = list(map(int, input().split()))

if len(L_list) < 3:
    print(0)
else:
    for pair in itertools.combinations(L_list, 3):
        if (pair[0] == pair[1]) or (pair[0] == pair[2]) or (pair[1] == pair[2]):
            continue

        if (pair[0] + pair[1] > pair[2]) and (pair[0] + pair[2] > pair[1]) and (pair[1] + pair[2] > pair[0]):
            pair_num += 1

    print(pair_num)

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

ans = 0

for i in itertools.combinations(L, 3):
  if len(set(i)) ==3 and sum(i) - 2 * max(i) > 0 :
    ans += 1

print(ans)

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

Solution (Python):
from itertools import combinations

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

triplets = combinations(sticks, 3)

count = 0
for triplet in triplets:
    if (
        (triplet[0] + triplet[1] > triplet[2])
        and (triplet[0] + triplet[2] > triplet[1])
        and (triplet[1] + triplet[2] > triplet[0])
    ):
        if len(set(triplet)) < 3:
            continue
        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):
            temp = sorted([L[i], L[j], L[k]])
            if temp[0]==temp[1] or temp[1]==temp[2]:
                continue
            if (temp[0]+temp[1])>temp[2] and (temp[1]+temp[2])>temp[0] and (temp[2]+temp[0])>temp[1]:
                count += 1
print(count)

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

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

for a, b, c in list(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 ):
    count += 1

print(count)

Solution (Python):
import itertools
N = int(input())
L = [int(x) for x in input().split()]

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

Solution (Python):

N=int(input())
L=list(map(int,input().split()))
count=0
for ii in range(N):
    for jj in range(ii+1,N):
        for kk in range(jj+1,N):
            if L[ii]!=L[jj] and L[jj]!=L[kk] and L[kk]!=L[ii] and L[ii]+L[jj]>L[kk] and L[jj]+L[kk]>L[ii] and L[kk]+L[ii]>L[jj]:
                count+=1
print(count)

Solution (Python):

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

seq = list(itertools.combinations(l, 3))

ans = 0

for item in seq:
    if item[0] == item[1] or item[1] == item[2] or item[2] == item[0]:
        continue
    if (item[0] + item[1] > item[2]) and (item[1] + item[2] > item[0]) and (item[2] + item[0] > item[1]):
        ans += 1
print(ans)

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

ans=0

for v in itertools.combinations(L,3):
  l=sorted(v)
  if len(set(l))==3:
    if l[2]<(l[1]+l[0]):
      ans+=1
print(ans)

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

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

def main():
    n = int(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[i] == l[k] or l[j] == l[k]:
                    continue
                if (l[i] + l[j]) <= l[k] or (l[i] + l[k]) <= l[j] or (l[j] + l[k]) <= l[i]:
                    continue
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import itertools

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

count = 0
for list in itertools.combinations(L, 3):
    if(len(set(list)) == 3 and max(list) < (sum(list) - max(list))):
        count += 1
print(count)

Solution (Python):

def ans(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]):
			        if len(set([arr[i],arr[j],arr[k]]))==3:
			            count += 1
	return count 


n = int(input())
arr = [int(x) for x in input().split()]
if(n<=2):
    print(0)
else:
    print(ans(arr,n))

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]: 
        a,b,c = L[i], L[j], L[k]
        flg = False
        if abs(a-b) < c < a+b:
          flg = True
        elif abs(b-c) < a < b+c:
          flg = True
        elif abs(c-a) < b < c+a:
          flg = True

        if flg: ans += 1

print(ans)

Solution (Python):
num_bars = int(input())
length_list = list(map(int,input().split()))
length_list.sort()


count = 0

for i in range(num_bars):
  a = length_list[i]
  for j in range(i + 1,num_bars):
    b = length_list[j]
    if a == b:
      continue
    else :
      for k in range(j + 1,num_bars):
        c = length_list[k]
        if b == c:
          continue
        if a + b <= c:
          continue
        count += 1

        
print(count)

Solution (Python):
import collections
import itertools
n = int(input())
l = list(map(int, input().split()))
c = collections.Counter(l)
ans = 0
p_list = list(itertools.combinations(c, 3))
for e in p_list:
  if e[0] + e[1] > e[2] and e[1] + e[2] > e[0] and e[2] + e[0] > e[1]:
    ans += c[e[0]] * c[e[1]] * c[e[2]]
print(ans)

Solution (Python):
n = int(input())
hen_list = list(map(int, input().split()))
count = 0

for x in hen_list:
  for y in hen_list:
    for z in hen_list:
      if (z > x and z > y and y > x) and x + y > z:
        count += 1

print(count)

Solution (Python):
from collections import Counter
from itertools import combinations

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

def can_triangle(d):
    d.sort()
    a, b, c = d
    return a+b > c


def solve():
    ans = 0
    for c in combinations(C.keys(), 3):
        if can_triangle(list(c)):
            ans += C[c[0]]*C[c[1]]*C[c[2]]
    return ans

if __name__ == "__main__":
    print(solve())

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

lst=[]
cnt=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            
            ln=max ( (l[i] , l[j] , l[k]) )
            if l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k] and ln<(l[i]+l[j]+l[k]-ln):
                cnt+=1
                
print(cnt)

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

Solution (Python):
N = int(input())
L= list(map(int, input().split()))
Ls = list(set(L))
res=[]
for i in range(len(Ls)):
  for j in range(i+1,len(Ls)):
    for k in range(j+1,len(Ls)):
      tmp=[Ls[i],Ls[j],Ls[k]]
      if sum(tmp) > 2*max(tmp):
        res.append(tmp)
        
c=0
for i in range(len(res)):
  ctmp=L.count(res[i][0])*L.count(res[i][1])*L.count(res[i][2])
  c+=ctmp
print(c)

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

cnt=0
for i in range(n-2):
  a=ls[i]
  for j in range(i+1,n-1):
    b=ls[j]
    if a==b:
      continue
    for k in range(j+1,n):
      c=ls[k]
      if a==c or b==c:
        continue
      if a+b <= c or a+c <= b or b+c <= a:
        continue
      else:
        cnt+=1
print(cnt)

Solution (Python):
def main():
    n=int(input())
    l = sorted(map(int, input().split()))
    ll=len(l)
    count = 0
    for x in range(ll-2):
        for y in range(x+1, ll-1):
            if l[x] == l[y]:
                continue
            for z in range(y+1, ll):
                if l[y] == l[z]:
                    continue
                if l[z] < l[x]+l[y]:
                    count += 1
                else:
                    break
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split()))
count =0
for v in itertools.combinations(L, 3):
    a=v[0]
    b=v[1]
    c=v[2]
    if a+b> c and b+c >a and c+a>b:
        if a!=b and b!=c and c!=a:
            count+=1

print(count)

Solution (Python):
import itertools
n = int(input())
l = list(map(int, input().split()))
len_list = list(itertools.combinations(l, 3))
answer = 0
for lens in len_list:
  if len(set(lens)) == 3 and lens[0] < lens[1] + lens[2] and lens[1] < lens[0] + lens[2] and lens[2] < lens[0] + lens[1]:
    answer += 1
print(answer)

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):
            s = [l[i],l[j],l[k]]
            s.sort()
            if len(set(s))==3 and s[0]+s[1]>s[2]:
                ans+=1
print(ans)

Solution (Python):
n = int(input())
lst = [int(i) for i in input().split()]
num_lst = sorted(list(set(lst)), reverse=True)

count = 0

for d in range(len(num_lst)-2):
    for a in range(d+1, len(num_lst)-1):
        for b in range(a+1, len(num_lst)):
            if num_lst[d] < num_lst[a] + num_lst[b]:
                cd = lst.count(num_lst[d])
                ca = lst.count(num_lst[a])
                cb = lst.count(num_lst[b])
                count += 1*cd*ca*cb
print(count)

Solution (Python):
import itertools

def checker(l):
    a, b, c = l
    if abs(a - b) < c and c < a + b and len(set(l)) == 3:
        return True
    else:
        return False

n = input()
l = [int(i) for i in input().split()]
c = 0
for v in itertools.combinations(l, 3):
    if checker(v) is True:        
        c += 1
print(c)

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

seq = ('a', 'b', 'c', 'd', 'e')
ptr = list(itertools.combinations(L,3))

cnt = 0
for i in range(len(ptr)):
    a = ptr[i][0]
    b = ptr[i][1]
    c = ptr[i][2]
    if a<b+c and b<a+c and c<a+b and a!=b and b!=c and c!=a:
        cnt += 1
print(cnt)

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

Solution (Python):
from  itertools import combinations 

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

count=0
for i in combinations(arr,3):
    a,b,c=i[0],i[1],i[2]
    
    if a!=b and b!=c and a+b>c:
        count+=1
        
print(count)

Solution (Python):

import itertools
n = int(input())
l = list(map(int, input().split()))
if len(l) <= 2:
  print(0)
else:
  count = 0
  for i in itertools.combinations(l, 3):
    if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
      if i[0] > abs(i[1]-i[2]) and i[0] < i[1] + i[2]:
        count += 1
  print(count)

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

num_len = len(l_list)
count = 0
for i in range(num_len):
    for j in range(i+1,num_len):
        for k in range(j+1,num_len):
            temp_list = sorted([l_list[i],l_list[j],l_list[k]])
            if len(set(temp_list))<3:
                continue
            elif temp_list[2]-temp_list[1]-temp_list[0]<0:
                count+=1
                
print(count)

Solution (Python):
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
L = inintl()

ans = 0

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

print(ans)

Solution (Python):
N = int(input())
li = list(map(int,input().split()))
c = 0
for i in li:
  for j in li:
    for k in li:
      li2 = [i,j,k]
      long = max(li2)
      if long*2 < i + j + k:
        if i!=k:
          if k!=j:
            if i !=j:
              c = c + 1
print(int(c/6))

Solution (Python):
import collections

N = int(input())

Ls = list(map(int,input().split()))
c = collections.Counter(Ls)

Ls = list(set(Ls))
Ls.sort()
N = len(Ls)

cnt = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if Ls[k]<Ls[i]+Ls[j]:
                cnt += 1 * c[Ls[i]]*c[Ls[j]]*c[Ls[k]]


print(cnt)

Solution (Python):


import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

from collections import Counter

def resolve():
    it = map(int, sys.stdin.read().split())
    N = next(it)
    L = Counter(it)
    ky = sorted(L.keys())
    n = len(ky)

    ans = 0
    for i in range(n-2):
        a = ky[i]
        ai = L[a]
        for j in range(i+1, n-1):
            b = ky[j]
            bi = L[b]
            ab = a + b
            for k in range(j+1, n):
                c = ky[k]
                ci = L[c]
                if ab <= c:
                    break
                ci = L[c]
                ans += ai * bi * ci
    print(ans)



if __name__ == "__main__":
    resolve()

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

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

l.sort()
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]:
                if l[i] + l[j] > l[k]:
                    c += 1

print(c)

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


cnt = 0
for i in range(N-2):
  for j in range(i,N-1):
    for k in range(j,N):
      if L[i] ==L[j] or L[j]==L[k] or L[i]==L[k]:
        continue
      elif L[i] + L[j] > L[k] and L[k] >abs(L[i] - L[j]):
        cnt +=1
        

print(cnt)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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):
            ll = [l[i],l[j],l[k]]
            if ll[2]<ll[0]+ll[1] and ll[1]<ll[0]+ll[2] and ll[0]<ll[1]+ll[2] and len(set(ll))==3:
                ans += 1

print(ans)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort()
res = 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 len(set([A[i], A[j], A[k]])) == 3:
                res += 1

print(res)

Solution (Python):
import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
 
 
def main():
    N = int(input())
    L = list(map(int,input().split()))
    ans=0
    for i in range(len(L)):
        for j in range(i,len(L)):
            for k in range(j,len(L)):
                if L[i]==L[j] or L[j]==L[k] or L[k]==L[i]:
                    continue
                l = sorted([L[i],L[j],L[k]])
                if l[2]>=l[1]+l[0]:
                    continue

                
                ans+=1
    print(ans)

 
if __name__ == '__main__':
    main()

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

Ls.sort(reverse=True)

count = 0
for k, Lk in enumerate(Ls[:-2]):
    for j, Lj in enumerate(Ls[k+1:-1]):
        for i, Li in enumerate(Ls[k+j+2:]):
            if Lk == Lj or Lj == Li or Li == Lk:
                continue
            if Lk < Lj + Li:
                count += 1

print(count)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
res = 0
for pi,i in enumerate(l):
  for pj,j in enumerate(l[pi+1:],pi+1):
    if j==i:
      continue
    for k in l[pj+1:]:
      if k==j or k==i:
        continue
      if i+j>k and j+k>i and k+i>j:
        res += 1
print(res)

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

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

Solution (Python):
from itertools import combinations

n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0

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

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

Solution (Python):
def get_array():
    l=list(map(int, input().split()))
    return l
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
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(ab(l[i],l[j],l[k])):
					
					c+=1
print(c)

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

print(int(c/6))

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

Solution (Python):
from itertools import combinations

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

def check(a,b,c):
    if a == b or b == c or c == a:
        return False

    if a + b > c and b +c > a and c + a > b:
        return True
    else:
        return False

ans = 0
for a, b, c in combinations(nums, 3):
    if check(a, b, c):
        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]:
            continue
        for k in range(j+1,n):
            if l[i]!=l[k] and l[j]!=l[k] and abs(l[i]-l[j])<l[k]<l[i]+l[j]:
                count+=1
print(count)