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

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

count=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            lengths = [L[i], L[j], L[k]]
            lengths.sort()
            if lengths[0] + lengths[1] > lengths[2]:
                count += 1

print(count)

Solution (Python):
n = int(input())
tree_lens = list(map(int, input().split()))
ans = 0
tree_lens.sort(reverse=True)
if n <= 2:
    print(ans)
else:
    for i in range(len(tree_lens)):
        for j in range(i + 1, len(tree_lens)):
            for k in range(j + 1, len(tree_lens)):
                if tree_lens[i] < tree_lens[j] + tree_lens[k] \
                        and tree_lens[i] != tree_lens[j] \
                        and tree_lens[j] != tree_lens[k]:
                    ans += 1
    print(ans)

Solution (Python):
num = int(input())
input_line = input().split(" ")
num_line = [int(n) for n in input_line]

num_line.sort()


del_numlis=[num_line[0]]
item_numlis=[]
counter=1

for i in range(1,num):
    if(num_line[i-1]==num_line[i]):
        counter += 1
    
    else:
        item_numlis.append(counter)
        counter = 1
        del_numlis.append(num_line[i])
        
item_numlis.append(counter)




del_numlis_len = len(del_numlis)
result = 0

for i  in range(del_numlis_len - 2):
    tri_1 = del_numlis[i]
    for j in range(i+1,del_numlis_len - 1):
        tri_2 = del_numlis[j]
        for k in range(j+1,del_numlis_len):
            tri_3 = del_numlis[k]
            
            if(tri_1 + tri_2 > tri_3):
                result += item_numlis[i]*item_numlis[j]*item_numlis[k]
            
print(result)

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

Solution (Python):
N = int(input())
l = list(map(int, input().split()))
d = {}

for x in l:
    if x in d.keys():
        d[x] = d[x] + 1
    else:
        d[x] = 1

keys = list(d.keys())
keys.sort()

cnt = 0
for i in range(len(keys)):
    for j in range(i + 1, len(keys)):
        for k in range(j + 1, len(keys)):
            if keys[i] + keys[j] <= keys[k]:
                continue
            cnt += d[keys[i]] * d[keys[j]] * d[keys[k]]

print(cnt)

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

L.sort()
ans = 0

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

print(ans)

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

ans = 0
for i in range(N):
    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
            _max = max(L[i], L[j], L[k])
            total = sum([L[i], L[j], L[k]])
            if total - _max > _max:
                ans += 1

print(ans)

Solution (Python):

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

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

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

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

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

cnt = 0
for idxi, i in enumerate(LS):
  for idxj, j in list(enumerate(LS))[idxi+1:]:
    for k in LS[idxj+1:]:
      if i != j and j != k and i != k:
        m = max(i, j, k)
        l = sum([i, j, k]) - m
        if l > m:
          cnt += 1

print(cnt)

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

trips = []

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]:
                trips.append([L[i], L[j], L[k]])

ans = 0

for i in trips:
    if max(i) < sum(i) - max(i):
        ans += 1

print(ans)

Solution (Python):
import sys

def input():
    return sys.stdin.readline().rstrip('\n')


def calc(N, L):
    d = {}
    for l in L:
        d[l] = (d[l] if l in d else 0) + 1
    M = list(d.keys())
    M.sort(key = lambda x: -x)
    ans = 0
    for i in range(len(M)):
        for j in range(i + 1, len(M)):
            for k in range(j + 1, len(M)):
                if M[i] < M[j] + M[k]:
                    ans += d[M[i]] * d[M[j]] * d[M[k]]
    return ans


N = int(input())
L = [int(s) for s in input().split()]
print(calc(N, L))

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

count = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if len(set([L[i], L[j], L[k]])) != 3:
                continue
            ls = sorted([L[i], L[j], L[k]])
            if ls[-1] < sum(ls[:-1]):
                count += 1
print(count)

Solution (Python):
n = int(input())
l = [int(_) for _ in input().split()]
print(sum(i < j < k < i + j for i in l for j in l for k in l))

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

from itertools import combinations

ans = 0
for x in combinations(l, 3):
    if max(x)*2 < sum(x) and len(set(x))==3:
        ans += 1
print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
point = 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]:
                if max(l[i],l[j],l[k])*2 < l[i]+l[j]+l[k]:
                    point += 1

print(point)

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

cn = 0
for k in range(N-2):
    a = L[k]
    for l in range(k+1,N-1):
        b = L[l]
        for m in range(l+1,N):
            c = L[m]
            if a + b > c and a != b and b != c and c != a:
                cn += 1

print(cn)

Solution (Python):
import itertools

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

ans=0
lis = sorted(lis)


for v in itertools.combinations(lis, 3):
    if (not(v[0]==v[1] or v[1]==v[2] or v[0]==v[2])) and (v[0]+v[1]>v[2]):
        
        ans+=1

print(ans)

Solution (Python):
n = int(input())
if n == 1 or n == 2:
    print(0)

else:
    len = list(map(int, input().split()))

    number = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                len.sort()
                if len[i] == len[j] or len[j] == len[k]:
                    continue
                elif len[j] - len[i] < len[k] and len[k] < len[i] + len[j]:
                    number += 1
                else:
                    continue
    print(number)

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

if n == 1 or n == 2:
    print(0)
else:
    ans = 0
    for i in range(n):
        for j in range(i + 1,n):
            for k in range(j+1,n):
                len.sort()
                if len[i] == len[j] or len[j] == len[k]:
                    continue
                if len[j] - len[i] < len[k] and len[j]  + len[i] > len[k]:
                    ans = ans + 1
                else :
                    continue
    print(ans)

Solution (Python):

import itertools


N = int(input())

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


count = 0

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

Solution (Python):
def judge(li, lj, lk):
    return li != lj and lj != lk and li != lk and li + lj > lk and lj + lk > li and li + lk > lj


if __name__ == "__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):
                if judge(L[i], L[j], L[k]):
                    ans += 1
    print(ans)

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

L = [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 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):
def is_exist_triangle(a, b, c):
    l = [a, b, c]
    l.sort()
    return l[0] + l[1] > l[2] if len(set(l)) == 3 else False


def main():
    n = int(input())
    length = 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):
                ans += 1 if is_exist_triangle(length[i], length[j], length[k]) else 0
    print(ans)


if __name__ == '__main__':
    main()

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

print(cnt)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
sticks = sorted(l)
count = 0
if n <= 2:
    print(0)
else:
    for x in range(n-2):
        for y in range(x+1,n-1):
            for z in range(y+1,n):
                if sticks[x] != sticks[y] and sticks[y] != sticks[z] and sticks[z] != sticks[x] and sticks[x] + sticks[y] > sticks[z]:
                    count += 1
    print(count)

Solution (Python):



from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        
        if (a != b) and (b != c) and (c != a):
            counter += 1

print(counter)

Solution (Python):



from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        a, b, c = sorted([a, b, c])
        if (a != b) and (b != c):
            counter += 1

print(counter)

Solution (Python):



from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        a, b, c = sorted([a, b, c])
        if (a != b) and (b != c):
            counter += 1

print(counter)

Solution (Python):
N = int(input())
leng = list(map(int, input().split( )))
count = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    if leng[i] == leng[j]:continue
    for k in range(j+1, N):
      if leng[i] == leng[k] or leng[j] == leng[k]:continue
      L = [leng[i],leng[j],leng[k]]
      if max(L) < sum(L)-max(L):
        count += 1
print(count)

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

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

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] or L[j] == L[k]:
                continue
            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):
it = lambda: list(map(int, input().strip().split()))

def solve():
    N = int(input())
    L = it()
    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] and L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[k] + L[j] > L[i]:
                    ans += 1
    return ans


if __name__ == '__main__':
    ans = solve()
    print(ans)

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

count = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            a, b, c = sticks[i], sticks[j], sticks[k]
            if a != b and a != c and b != c:
                if a + b > c and b + c > a and c + a > b:
                    count += 1

print(count)

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

print(s)

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

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

Solution (Python):
import itertools
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]:
                if l[i] != l[k]:
                    if 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]:
                            cnt += 1
print(cnt)

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
if len(l) < 3:
  print(0)
else:
  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[j] < l[k] < l[i] + l[j]:
            cnt += 1
          elif l[k] >= l[i] + l[j]:
            break
  print(cnt)

Solution (Python):
n = int(input())
l = [int(x) for x in input().split()]
l = sorted(l)
m = {}
for x in l:
    if x in m:
        m[x] += 1
    else:
        m[x] = 1

awa = []
last = -1
for x in l:
    if x == last:
        continue
    awa.append(x)
    last = x

num = 0
for x in range(len(awa)-2):
    for y in range(x+1,len(awa)-1):
        for z in range(y+1,len(awa)):
            if awa[x] + awa[y] > awa[z] and awa[x] + awa[z] > awa[y] and awa[y] + awa[z] > awa[x]:
                num += m[awa[x]] * m[awa[y]] * m[awa[z]]

print(num)

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

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

n = len(L)
c = 0
result = []
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]:
                    
                    c += 1
print(c)

Solution (Python):
import sys


import itertools

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

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

for combi in combis:
	a, b, c = combi

	if a != b and b != c and c != a:
		if a + b > c and b + c > a and c + a > b:
			ans += 1

print(ans)

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

Solution (Python):
import itertools as it


N = int(input())
s = list(map(int, input().split()))
s.sort()
count = 0


c = it.combinations(s, 3)

for i in c:
    if i[0] == i[1] or i[1] == i[2] or i[2] == i[0]:
        continue
    elif (i[0] + i[1]) > i[2]:
        count += 1

print(count)

Solution (Python):
import itertools as it


N = int(input())
s = list(map(int, input().split()))
s.sort()
count = 0


c = it.combinations(s, 3)

for i in c:
    listed = list(i)
    if listed[0] == listed[1] or listed[1] == listed[2] or listed[2] == listed[0]:
        continue
    if (listed[0] + listed[1]) > listed[2]:
        count += 1

print(count)

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

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a = l[i]
            b = l[j]
            c = l[k]
            if not len(set([a, b, c])) == 3:
                continue
            if abs(a-b) < c < a + b:
                cnt += 1
                
print(cnt)

Solution (Python):
import itertools as it


N = int(input()) - 1
s = list(map(int, input().split()))
count = 0

c = it.combinations(s, 3)

for i in c:
    listed = list(i)
    if listed[0] == listed[1] or listed[1] == listed[2] or listed[2] == listed[0]:
        continue
    maximum = max(listed)
    listed.remove(maximum)
    if (listed[0] + listed[1]) > maximum:
        count += 1

print(count)

Solution (Python):
import math
import itertools
from itertools import combinations
N = int(input())
A = input().split()
list = [int(n) for n in A]
a = 0
for v in itertools.combinations(list, 3):
    u = sorted(v)
    if u[0] != u[1] != u[2]:
        if u[2] < u[1]+u[0] and u[1]-u[0] < u[2]:
            a = a+1
        else:
            continue
    else:
        continue
print(a)

Solution (Python):
import math
import itertools
from itertools import combinations
N = int(input())
A = [[]] * N
A = input().split()
list = [int(n) for n in A]
a = 0
for v in itertools.combinations(list, 3):
    u = sorted(v)
    if u[0] != u[1] != u[2]:
        if u[2] < u[1]+u[0] and u[1]-u[0] < u[2]:
            a = a+1
        else:
            continue
    else:
        continue
print(a)

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

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

L.sort()

candidates = itertools.combinations(L, 3)

count = 0

for t in candidates:
    if t[0] == t[1] or t[1] == t[2]:
        continue
    if t[0] + t[1] > t[2]:
        count += 1

print(count)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort
ans = 0
for i in range(n):
  for j in range(n):
    if i ==	j:
      continue
    for k in range(n):
      if j == k:
        continue
      elif i == k:
        continue
      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()))
ans = 0

def f(x,y,z):
    global L
    if L[x] + L[y] > L[z]:
        return True
    else:
        return False

def g(x,y,z):
    global L
    if L[x] != L[y] and L[z] != L[y] and L[x] != L[z]:
        return True
    else:
        return False

for p in range(len(L)-2):
    for q in range(p+1,len(L)-1):
        for r in range(q+1,len(L)):
            if f(p,q,r) and f(q,r,p) and f(r,p,q) and g(p,q,r):
                ans += 1

print(ans)

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

print(ans)

Solution (Python):

import math
from operator import mul
from functools import reduce
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)




def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
L = zz()
L = sorted(L)
ans = 0
for i, j, k in itertools.combinations_with_replacement(range(N), 3):
    if((L[i] + L[j] > L[k]) and (not ((L[i] == L[k]) or (L[i] == L[j]) or (L[j] == L[k])))):
        
        ans += 1
print(ans)

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

L=[]
for i in array:
    L.append(i)

L=sorted(L)

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

L.sort()

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

print(cnt)

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


L.sort()

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

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

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

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

sorted_Long = sorted(Long)

count = 0

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

print(count)

Solution (Python):



def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    n = next_int()
    ar = sorted(next_int_array_one_line())
    res = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if ar[i] < ar[j] and ar[j] < ar[k] and ar[i] + ar[j] > ar[k]:
                    res += 1
    print(res)


if __name__ == '__main__':
    main()

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

Solution (Python):

def input_array():
	return list(map(int,input().split()))
  
n=int(input())
L=input_array()
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[i]!=L[k]:
				a=L[i]+L[j]
				b=L[j]+L[k]
				c=L[i]+L[k]
				if a>L[k] and b>L[i] and c>L[j]:
					count+=1

print(count)

Solution (Python):
N = int(input())
l = sorted([int(x) for x in input().split()])
ans = 0
if N < 3:
    print(0)
    exit()
for i in range(N-2):
    for j in range(i+1, N-1):
        if l[i] == l[j]:
            continue
        for k in range(j+1, N):
            if l[j] == l[k]:
                continue
            if l[i] + l[j] > l[k]:
                ans += 1
print(ans)

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

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

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

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

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

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

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

Solution (Python):

from itertools import combinations

class main:
  def T(array):
    cnt = 0
    for i in array:
      a, b, c = i
      if a != b and a != c and b != c and a < b + c:
        cnt += 1
    print(cnt)

  def Sort(array):
    for i in range(len(array)):
      array[i] = sorted(array[i], reverse=True)
    return array

if __name__ == "__main__":
  n = int(input())
  l = list(map(int, input().split()))
  array = list(combinations(l, 3))
  array = main.Sort(array)
  main.T(array)

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

counter = 0
for i in range(N):
    for j in range(i,N):
        for k in range(j,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 L[i]+L[k] > L[j] and L[j]+L[k] > L[i]:
                counter += 1
                """
                print("i:%d" % (i+1))
                print("j:%d" % (j+1))
                print("k:%d" % (k+1))
                print("\n")
                """
print(counter)

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[i]==L[k]:
        continue
      if 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):
n = int(input())
l = list(map(int, input().split(" ")))
count = 0
for i in range(n):
    li = l[i]
    for j in range(i + 1, n):
        lj = l[j]
        if li == lj:
            continue
        for k in range(j + 1, n):
            lk = l[k]
            if li == lk or lj == lk:
                continue
            if (
                li + lj > lk and
                lj + lk > li and
                lk + li > lj
            ):
                count += 1
print(count)

Solution (Python):
import itertools

N=int(input())
L=list(map(int,input().split()))
L.sort()
l=list(itertools.combinations(L,3))

ans=0
for i in l:
    if len(i)==len(set(i)) and i[2]<i[1]+i[0]:
        ans+=1

print(ans)

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

L.sort()


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

print(count)

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

for i in range(0, n-2):
    for j in range(i + 1, n-1):
        for k in range(j + 1, n):
            if s[i] < s[j] < s[k] and s[i] + s[j] > s[k]:
                count += 1
            else:
                continue

print(count)