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

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

count = 0

for i in range(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]:
                Li = [L[i], L[j], L[k]]
                max_Li = max(Li)
                Li.remove(max_Li)
                if max_Li < Li[0] + Li[1]:
                    count += 1

print(count)

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

line = input().split()

num1 = 0
num2 = 0
temp = 0
ans = 0

for i in range(N) :
    num1 = int(line[i])
    for j in range(i+1,N) :
        if int(line[j]) != num1 :
            num2 = int(line[j])
            temp = j
            for k in range(temp+1,N) :
                temp = int(line[k])
                if temp == num1 or temp == num2 :
                    continue
                if num1 + num2 > temp and num1 + temp > num2 and num2 + temp > num1 :
                    ans += 1


print(ans)

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

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

if n<=2:
    print('0')
else:
    for i in range(n-2):
        for e in range(1,n-1):
            for o in range(2,n):
                if o<=e or o<=i or e<=i or l[i]==l[e] or l[e]==l[o] or l[i]==l[o]:
                    con+=0
 
                elif l[i]+l[e]>l[o] and l[e]+l[o]>l[i] and l[o]+l[i]>l[e]:
                    con+=1
                                         
    print(con)

Solution (Python):
from itertools import permutations, combinations, combinations_with_replacement, product
import fractions
from collections import Counter

n = int(input())
listA = map(int, input().split())
Cs = list(combinations(listA, 3)) 
ans = 0
for li in Cs:
  if (li[0]+li[1]>li[2]) and (li[1]+li[2]>li[0]) and (li[0]+li[2]>li[1]) and not li[0] == li[1] and not li[1] == li[2] and not li[2]==li[0]:
    ans+=1
print(ans)

Solution (Python):
import collections

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

L = collections.Counter(L_list)
L_modi = list(L.keys())




cnt = 0

for i in range(len(L_modi)-2):
    for j in range(i+1, len(L_modi)-1):
        for k in range(j+1, len(L_modi)):
            if L_modi[i] + L_modi[j] > L_modi[k]:
                cnt += L[L_modi[i]]*L[L_modi[j]]*L[L_modi[k]]
                

print(cnt)

Solution (Python):
import itertools
n=int(input())
length=list(map(int,input().split()))
combination=list(itertools.combinations(length,3))
new_list=[]
for com in combination:
    a=com[0]
    b=com[1]
    c=com[2]
    if a!=b and b!=c and a!=c:
        if com[0]+com[1]>com[2] and com[1]+com[2]>com[0] and com[0]+com[2]>com[1]:
            new_list.append(com)
        else:
            continue
print(len(new_list))

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

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

Solution (Python):
from itertools import combinations

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


def isRectangle(pair):
    if len(pair) < 3:
        return False
    if pair[0] == pair[1] or pair[1] == pair[2] or pair[2] == pair[0]:
        return False
    return (
        pair[0] + pair[1] > pair[2]
        and pair[1] + pair[2] > pair[0]
        and pair[0] + pair[2] > pair[1]
    )


c = list(combinations(L, 3))

count = 0
for i in range(len(c)):
    if isRectangle(c[i]):
        count += 1
print(count)

Solution (Python):
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 


def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x





	

def main():
	n=ii()
	arr=sorted(li())
	cnt=0
	for i in range(n-2):
		for j in range(i+1,n-1):
			if arr[i]!=arr[j]:
				for k in range(j+1,n):
					if arr[j]!=arr[k]:
						if arr[i]+arr[j]>arr[k] and arr[k]+arr[j]>arr[i] and arr[i]+arr[k]>arr[j]:
							cnt+=1
	print(cnt)













	
	
	






		







		
		
	
		

	







		









if __name__ == '__main__':
	main()

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

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
cnt = 0
for i in range(0, len(l) - 2):
    for j in range(i + 1, len(l) - 1):
        for k in range(j + 1, len(l)):
            length = l[i] + l[j] + l[k]
            max_len = max(l[i], l[j], l[k])
            rest = length - max_len
            if max_len < rest and l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                cnt += 1
print(cnt)

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

res = 0
for i in range(len(numl)):
    for j in range(len(numl)):
        if(i <= j):
            break
        else:
            for k in range(len(numl)):
                if((numl[i] + numl[j]> numl[k]) and (i < k) and (numl[k] + numl[j]> numl[i]) and (numl[i] + numl[k]> numl[j])and numl[i] != numl[j]and numl[j] != numl[k] and numl[k] != numl[i]):
                    
                    
                    res+=1
print(res)

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

arr = [int(x) for x in input().split()] 
ans = 0
if n>=3:
	for i in range(0,n):
		for j in range(i+1,n):
			if arr[i]==arr[j]:
				continue
			for k in range(j+1,n):
				if arr[j]==arr[k] or arr[i]==arr[k]:
					continue
				
				if arr[i]+arr[j]>arr[k] and abs(arr[i]-arr[j])<arr[k]:
					ans+=1

print(ans)

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

import itertools

for i in itertools.combinations(L, 3):
    if i[0] != i[1] and i[1] != i[2] and i[2] != i[0]:
        j = sorted(i)
        if j[0] + j[1] > j[2]:
            ans += 1

print(ans)

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

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

print(cnt)

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

Solution (Python):
import itertools

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

count = 0
for tuple in itertools.combinations(L, 3):
    a, b, c = list(tuple)
    if tuple[0]!=tuple[1] and tuple[1]!=tuple[2] and tuple[2]!=tuple[0]:
        if a+b>c and b+c>a and c+a>b:
            count += 1 
print(count)

Solution (Python):
x=int(input())
arr=list(map(int, input().split()))
d=dict()
for i in arr:
  if i in d:
    d[i]+=1
  else:
    d[i]=1
coun=0
a=sorted(d.keys())
l=len(a)
for i in range(l-2):
  for j in range(i+1,l-1):
    k=j+1
    temp=a[i]+a[j]
    curr=d[a[i]]*d[a[j]]
    while k<l:
      if temp>a[k]:
        coun+=(curr*d[a[k]])
        k+=1
      else:
        break
print(coun)

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

Solution (Python):
def abc175b_making_triangle():
    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]:
                continue
            for k in range(j + 1, n):
                if l[i] == l[k] or l[j] == l[k]:
                    continue
                longest = max(l[i], l[j], l[k])
                total = l[i] + l[j] + l[k]
                if longest < total - longest:
                    cnt += 1
    print(cnt)

abc175b_making_triangle()

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

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

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

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

ans = 0
for i in range(0, N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            arr = [L[i], L[j], L[k]]
            arr.sort()
            if (arr[0] != arr[1] & arr[1] != arr[2]):
                if (arr[2] < arr[0] + arr[1]):
                    ans = ans + 1

print(ans)

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

print(ans)

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

Solution (Python):
import math
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

N = I()
L = LI()
count =0
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      flag = 0
      l1 = [L[i],L[j],L[k]]
      l = sorted(l1)
      for n in range(3):
        if(l.count(l[n])>1):
          flag = 1
      if(flag == 0):
        if(l[1]-l[0] < l[2] and l[1]+l[0] > l[2]):
          count += 1
print(count)

Solution (Python):
import itertools
N = int(input())
L = input().split()
L = [int(x) for x in L]
counter = 0
if N < 3:
  print(0)
  exit()
listed = {}
set_li = []
for i in L:
  if i in listed:
    listed[i] += 1
  else:
    listed[i] = 1
for i in L:
  if i in set_li:
    continue
  else:
    set_li.append(i)
p_lis = []
for p in itertools.combinations(set_li, 3):
  p_lis.append(p)
for i in p_lis:
  a, b, c = i[0], i[1], i[2]
  if a + b > c and a + c > b and b + c > a:
    counter += 1 * listed[a] * listed[b] * listed[c]
print(counter)

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

Solution (Python):
n = int(input())
l = tuple(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
      ll = [l[i],l[j],l[k]]
      ll.sort()
      if ll[2] < ll[0]+ll[1]:
        
        ans += 1
print(ans)

Solution (Python):
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n=int(input())
l=get_array()
ans=0
for x in range(n):
    for y in range(x+1,n):
        for z in range(y+1,n):
            if l[x]!=l[y] and l[y]!=l[z] and l[x]!=l[z]:
                if l[y]+l[z]>l[x] and l[x]+l[y]>l[z] and l[x]+l[z]>l[y]:
                    ans+=1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
count = 0
if n < 3:
  pass
else:
  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 abs(a-c)<b<a+c and a!=b and b!=c and c!=a:
          count += 1
print(count)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
if N < 3:
  ans = 0
else:
  ans_list = []
  for i in range(N - 2):
    for j in range(i+1, N - 1):
      if L[i] == L[j]:
        pass
      else:
        for k in range(j + 1, N):
          if L[i] != L[k] and L[j] != L[k]:
            l_list = [L[i], L[j], L[k]]
            L_max = max(l_list)
            L_other = [l for l in l_list if l != L_max]
            if L_max < sum(L_other):
              ans_list.append(i)
  ans = len(ans_list)
print(ans)

Solution (Python):
n = int(input())
list = list(map(int, input().split()))
count = 0
for i_1 in range(n-2):
    for i_2 in range(i_1+1,n-1):
        for i_3 in range(i_2+1,n):
            if list[i_1] != list[i_2] and list[i_1] != list[i_3] and list[i_2] != list[i_3]:
                if abs(list[i_2]-list[i_3]) < list[i_1] < list[i_2]+list[i_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,N):
        if i==j:
            continue
        else:
            for k in range(j,N):
                if i==k:
                    continue
                elif j==k:
                    continue
                else:
                    temp_max = max(L[i],L[j],L[k])
                    if L[i]+L[j]+L[k] > 2*temp_max:
                        if L[i]==L[j] or L[j]==L[k] or L[k]==L[i]:
                            continue
                        else:
                            ans += 1

print(ans)

Solution (Python):
def triangle(a, b, c):
    return (a + b > c and b + c > a and c + a > b)

def differ_num(a,b,c):
    return not (a == b or b == c or c == a)

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 triangle(L[i],L[j],L[k]) and differ_num(L[i],L[j],L[k]):
                ans += 1

print(ans)

Solution (Python):


def main(l):
    if len(l) < 3:
        return 0

    l.sort()
    p = 0
    for i in range(0, N - 2):
        for j in range(i + 1, N - 1):
            if l[j] == l[i]:
                continue
            for k in range(j + 1, N):
                if l[k] == l[j]:
                    continue
                if l[i] + l[j] <= l[k]:
                    break
                p += 1
    return p


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

Solution (Python):

N = int(input())
bar = [int(n) for n in input().split(' ')]
count = 0
if N >= 3:
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                if (bar[i] != bar[j]) and (bar[j] != bar[k]) and (bar[k] != bar[i]):
                    if (bar[i] + bar[j] > bar[k]) and (bar[i] + bar[k] > bar[j]) and (bar[k] + bar[j] > bar[i]):
                        count += 1

print(count)

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

Solution (Python):
from itertools import combinations

n = int(input())
l = map(int, input().split())
count = 0
for i in  combinations(l, 3):
	c = sorted(set(i))
	if len(c) == 3:
		if c[0] + c[1] > c[2]:
			count += 1
print(count)

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

count = 0
for a, b, c in l:
    if a+b>c and b+c>a and c+a>b:
        count +=1*L.count(a)*L.count(b)*L.count(c)
print(count)

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

count = 0
if N<=2:
    print(0)
    exit()

for i in range(N-2):
    L1 =L[i]
    for s in range(i+1,N-1):
        L2 = L[s]
        if L1 == L2:
            continue
        for n in range(s+1,N):
            L3=L[n]
           
            if L1==L3 or L2 == L3:
                continue

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

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

Solution (Python):


import itertools


def is_triangle(a, b, c):
    return abs(b - c) < a < b + c


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

for triangle in triangles:
    a = triangle[0]
    b = triangle[1]
    c = triangle[2]

    if (a != b and b != c and c != a) and is_triangle(a, b, c):
        count += 1

print(count)

Solution (Python):
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)
if N < 3:
    print(0)
    exit()

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[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())
arr=list(map(int,input().split()))
dummy=len(arr)
ans=0
if dummy>2:
    for i in range(dummy-2):
        for j in range(i+1,dummy-1):
            for k in range(j+1,dummy):
                if arr[i]!=arr[j] and arr[j]!=arr[k] and arr[k]!=arr[i]:
                    if arr[i]<arr[j]+arr[k] and arr[j]<arr[k]+arr[i] and arr[k]<arr[j]+arr[i]:
                        ans+=1
    print(ans)
else:
    print(0)

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

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

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

print(t)

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

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

    if(N<3):
        print(ans)
        return 0
    for x in range(N):
        for y in range(x+1,N):
            for z in range(y+1,N):
                if(L[x]!=L[y] and L[y]!=L[z] and L[z]!=L[x]):
                    if(L[x]+L[y]>L[z] and L[y]+L[z]>L[x] and L[z]+L[x]>L[y]):
                        ans+=1
    print(ans)

a()

Solution (Python):
def main():
  n = int(input())
  num_set = list(map(int, input().split()))
  if n < 3:
    print(0)
    exit()
  cnt = 0
  for i in range(len(num_set)):
    for j in range(i+1, len(num_set)):
      for k in range(j+1, len(num_set)):
        if num_set[i]==num_set[j] or num_set[i]==num_set[k] or num_set[j]==num_set[k]:
          continue
        if num_set[i]+num_set[j] > num_set[k] and num_set[k]+num_set[j] > num_set[i] and num_set[i]+num_set[k] > num_set[j]:
          cnt += 1
  print(cnt)
if (__name__=='__main__'):
  main()

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

Solution (Python):
import numpy as np

n=int(input())

a=list(map(int,input().split()))
a.sort(reverse=True)

r=0
for ii in range(len(a)-2):
	for jj in np.arange(ii+1,len(a)-1):
		for kk in np.arange(jj+1,len(a)):
			if a[ii]==a[jj] or a[jj]==a[kk] or a[kk]==a[ii]:
				pass
			else:
				if a[ii]<a[jj]+a[kk]:
					
					r+=1

print(r)

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


ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j + 1, n):

            if l[i] + l[j] > l[k] and l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:

                ans += 1

print(ans)

Solution (Python):


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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


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


count = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            count += check(L[i], L[j], L[k])


print(count)

Solution (Python):
n = int(input())
l_list = 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_list[i] == l_list[j] or l_list[j] == l_list[k] or l_list[k] == l_list[i]:
                continue
            else:
                total = l_list[i] + l_list[j] + l_list[k]
                max_l = max(l_list[i], l_list[j], l_list[k])
                
                
                if total - max_l*2 > 0:
                    count += 1

print(count)

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

L = list(reversed(sorted(L)))
cnt = 0
for i1, l1 in enumerate(L):
    for i2, l2 in enumerate(L[i1+1:]):
        for i3, l3 in enumerate(L[(i1 + i2 + 1):]):
            if len(set([l1, l2, l3])) != 3:
                continue
            if l1 >= (l2 + l3):
                break
            cnt += 1
print(cnt)

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

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


count = 0 
for i in range(N):
  for j in range(N - (i + 1)):
    
    for k in range(N - (i + j + 2)):
      
      
      
      
      Ss = sorted([Ls[i],Ls[i + j + 1], Ls[i + j + k + 2]])
      if (Ss[0] + Ss[1] > Ss[2]) and (Ss[0] != Ss[1]) and (Ss[1] != Ss[2]):
        
        count += 1
print(count)

Solution (Python):
import numpy as np

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

result = 0
tmp = []
for i, L1 in enumerate(Ls):
    for j, L2 in enumerate(Ls[i+1:]):
        j+=1+i
        if L1==L2 or len(Ls)<=j:
            continue
        if i==j:
            continue
        for k, L3 in enumerate(Ls[j+1:]):
            k+=1+j
            if L1==L3 or L2==L3:
                continue
            if len(Ls)<=k:
                continue
            if i==k or j==k:
                continue
            tri = [L1,L2,L3]
            arg = np.argmax(tri)
            max_ = 0
            residual = 0
            for l, length in enumerate(tri):
                if arg == l:
                    max_+=length
                else:
                    residual+=length
            if max_<residual:
                result+=1
print(result)

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

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    L = list(map(int, input().split()))

    if N < 3:
        print(0)
        return

    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[i] == L[k] or L[j] == L[k]:
                    continue
                a = sorted([L[i], L[j], L[k]])
                if a[0] + a[1] > a[2]:
                    ans += 1
    print(ans)


main()

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

c = 0
s = []
l.sort()

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] and l[k] != l[i]:
                c = c + 1

print(c)

Solution (Python):
import itertools
n = int(input())
li = list(map(int,input().split()))	
c = 0
L = []

for v in itertools.combinations(li, 3):
    
    
    L.append(v)
  
for i in L:
    if(i[0] == i[1] or i[1] == i[2] or i[2] == i[0]):
        c += 0
    else:
        
        if(i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]):
            c += 1

print(c)

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

Solution (Python):
import itertools
N = int(input())
if N < 3:
    print(0)
    exit()
L = list(map(int, input().split()))
r = 0
for x, y, z in itertools.combinations(L, 3):
    if x == y or x == z or y == z:
        continue
    if x + y > z and y + z > x and z + x > y:
        r += 1
print(r)

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

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

print(ans)

Solution (Python):

def main():
    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) or (b + c <= a) or (c + a <= b):
                    continue
                if (a != b and b != c and c != a):
                    ans += 1
                    
    
    print(ans)


if __name__ == '__main__':
    main()

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

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

import itertools
l = list(itertools.combinations(range(1, N + 1), 3))
ans = 0
for c in l:
    a, b, c = sorted([L[c[0]-1], L[c[1]-1], L[c[2]-1]], reverse = True)
    if (a < b + c) and not (a == b or b == c or c == a):
        ans += 1
print(ans)

Solution (Python):
import collections
n=int(input())
p=input()
ll=[int(n) for n in p.split()]
x=collections.Counter(ll)
y=list(set(ll))
y.sort()
n=len(y)
c=0
for i in range(n-2):
    for l in range(i+1,n-1):
        for j in range(l+1,n):
            if y[i]+y[l]>y[j]:
                c+=x[y[i]]*x[y[l]]*x[y[j]]
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):
		if L[i] != L[j]:
			for k in range(j+1, N):
				if L[k] != L[j]:
					if L[i] + L[j] > L[k]:
						ans += 1
print(ans)