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())
ans = 0
if n < 3:
  print(0)
  quit()
  
alis = sorted(list(map(int, input().split())))
for i in range(0, n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if alis[i] + alis[j] > alis[k]:
        if alis[i] - alis[j] != 0:
          if alis[j] - alis[k] != 0:
            ans += 1
        
print(ans)

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

Solution (Python):
N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    n1 = L_list[i]
                    n2 = L_list[j]
                    n3 = L_list[k]                   
                    if n1 + n2 > n3 and n1 + n3 > n2 and n3 + n2 > n1:
                        c += 1
    print(c)

Solution (Python):
from itertools import combinations


def main():
    N = int(input())
    L = tuple(map(int, input().split()))

    answer = solve(N, L)

    print(answer)


def solve(N, L):
    three_bar_combinations = tuple(combinations(L, 3))

    if not three_bar_combinations:
        return 0

    count = 0
    for c in three_bar_combinations:
        if len(c) != len(set(c)):
            continue

        if max(c) < sum(c) - max(c):
            count += 1

    return count


if __name__ == "__main__":
    main()

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

l.sort()

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]:
        c += 1

print(c)

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

import itertools

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

Solution (Python):
import itertools

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

count = 0
for a in itertools.combinations(L, 3):
    if len(set(a)) != 3:
        continue
    a = sorted(a)
    if a[2] < a[0] + a[1]:
        count += 1
print(count)

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

for i in range(N - 2):
  a = sort_L[i]
  for j in range(i + 1,N - 1):
    b = sort_L[j]
    for k in range(j + 1,N):
      c = sort_L[k]
      if (a != b) and (b != c) and (a != c) and (abs(a-b) < c < (a + b)):
        count = count + 1
      
print(count)

Solution (Python):
import itertools

N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
ref = list(itertools.combinations(L, 3))
cnt = 0
for i in ref:
  Li = i[0]
  Lj = i[1]
  Lk = i[2]
  if Li + Lj > Lk and Lj + Lk > Li and Lk + Li > Lj:
    if Li != Lj and  Lj!= Lk and Lk != Li:
      cnt += 1

print(cnt)

Solution (Python):




n = int(input())

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

ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if l[i] <= l[j] + l[k] and l[j] <= l[i] + l[k] and l[k] <= l[i] + l[j] and l[i] != l[j] and l[j] != l[k] and \
                    l[i] != l[k]:
                if max(l[i], l[j], l[k]) < (l[i] + l[j] + l[k]) / 2:
                    ans += 1
                    

print(ans)

Solution (Python):

N = int(input())
L = list(map(int,input().split()))
ans = 0
frag = 0
if len(L) <= 2:
  ans = 0
else:
  for a in range(0,N-2):
    for b in range(a+1,N-1):
      for c in range(b+1,N):
        if L[a] == L[b] or L[a] == L[c] or L[b] == L[c]:
          continue
        if L[a]+L[b] > L[c] and L[b]+L[c] > L[a] and L[c]+L[a] > L[b]:
          ans += 1

print(ans)

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

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

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 k != i and k != j:
                max_t = max(l[i], l[j], l[k])
                if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
                    count += (l[i] + l[j] + l[k] - max_t) > max_t
print(count)

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
ans = 0
if n<3:
    print(0)

else:
    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                max_L = max(L[i],L[j],L[k])
                min_L = min(L[i],L[j],L[k])
                mid_L = L[i]+L[j]+L[k]-max_L-min_L
                if (((min_L+mid_L)>max_L) & (min_L!=mid_L!=max_L)):
                    ans+=1
    print(ans)

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

L = sorted(L, reverse=False)
cnt = 0

for i in range(N):
    l_i = L[i]
    for j in range(N-i):
        if L[i+j] != l_i:
            l_j = L[i+j]
            for k in range(N-i-j):
                if (L[i+j+k] != l_j) and (l_i + l_j > L[i+j+k]):
                    l_k = L[i+j+k]
                    cnt += 1
                    
print(cnt)

Solution (Python):
num = int(input())
len = list(map(int,input().split()))
count = 0
max = 0
m1 = 0
m2 = 0




for i in range(num):
    for j in range(num):
        for k in range (num):
            if (len[i] != len[j]) and (len[i] != len[k]) and (len[j] != len[k]):
                if len[i] > len[j]:
                    max = len[i]
                    m1  = len[j]
                else:
                    max = len[j]
                    m1  = len[i]
                if len[k] > max:
                    m2  = max
                    max = len[k]
                else:
                    m2 = len[k]

                if (m1 + m2) > max:
                    if (i>j) and (j>k):
                        count += 1

print(count)

Solution (Python):
def main():
    N = input()
    L = input().split()

    cnt = 0

    for i in range(len(L)):
        iValue = L[i]
        for j in range(i + 1, len(L)):
            jValue = L[j]
            for k in range(j + 1, len(L)):
                kValue = L[k]
                rl = [int(iValue), int(jValue), int(kValue)]
                rl.sort()
                if iValue != jValue and jValue != kValue and iValue != kValue:
                    if (int(rl[0]) + int(rl[1])) > int(rl[2]):
                        
                        cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

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

    if n < 3:
        print(0)
        return
        
    count = 0
    for a in range(n-2):
        for b in range(a+1,n-1):
            for c in range(b+1,n):
                if ((l[a] + l[b] > l[c] and l[b] + l[c] > l[a] and l[a] + l[c] > l[b])and 
                    (l[a] != l[b] and l[b] != l[c] and l[a] != l[c])):
                    count += 1

    print(count)
main()

Solution (Python):
n=int(input())
li = 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):
            m=max(li[i],li[j],li[k])
            s=li[i]+li[j]+li[k]
            if li[i] != li[j] and  li[i] != li[k] and li[j] != li[k] and s-m>m:
                ans+=1

print(ans)

Solution (Python):
X = int(input())
A = list(map(int, input().split()))


count = 0
for i in range(len(A)):
    for j in range(i+1,len(A)):
        for k in range(j+1,len(A)):
            
            tmp = sorted([A[i],A[j],A[k]])
            if (tmp[2]<tmp[0]+tmp[1])and (tmp[0]<tmp[1]<tmp[2]) :
                count+=1


print(count)

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

count = 0
ans = []
for i in range(N-2):
  for s in range(1,N-1):
    for k in range(2,N):
      if a[k]<a[i]+a[s] and a[s]<a[i]+a[k] and a[i]<a[k]+a[s]:
        if i<s<k:
          if a[k]!=a[i] and a[k]!=a[s] and a[i]!=a[s] :
       
            count+=1
      
print(count)

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

count=0

import collections

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

c = collections.Counter(L)
l=sorted(list(c.keys()))

le=len(l)

for i in range(le-2):
    for j in range(i+1,le-1):
        for k in range(j+1,le):
            if check(l[i],l[j],l[k]):
                count+=c[l[i]]*c[l[j]]*c[l[k]]
                
print(count)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
score = 0
for f in range(n-2):
	for s in range(f+1,n-1):
		for t in range(s+1,n):
			if a[f]+a[s]>a[t] and a[f] != a[s] and a[f]!=a[t] and a[s]!=a[t]:
				score += 1
print(score)

Solution (Python):
from collections import Counter
import itertools

n, *l = map(int, open(0).read().split())
c = Counter(l)
c_key = c.keys()
ans = 0
for v in itertools.combinations(c_key, 3):
    v_sorted = sorted(list(v))
    if v_sorted[0] + v_sorted[1] > v_sorted[2]:
        ans += c[v[0]]*c[v[1]]*c[v[2]]
print(ans)

Solution (Python):
def resolve():
	count = 0
	N = int(input())
	L = sorted(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]:
					None
				elif L[j] == L[k]:
					None
				elif L[i] == L[k]:
					None
				elif (L[i] + L[j]) > L[k]:
					
					count += 1
	print(count)
resolve()

Solution (Python):
import itertools

N = int(input())
li = list(map(int, input().split()))
if N <= 2:
    print('0')
else:
    cnt = 0
    for team in itertools.combinations(li, 3):
        i = team[0]
        j = team[1]
        k = team[2]
        if i + j > k and j + k > i and k + i > j:
            if i != j and j != k and k != i:
                cnt += 1
    print(cnt)

Solution (Python):
import itertools
import math

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

if n <= 2 :
    print(0)
    exit()
per = list(itertools.combinations(length, 3))
count = 0
for i in range(len(per)):
    if len(per[i]) == len(set(per[i])) :
       if (math.fabs(per[i][0] - per[i][1]) < per[i][2]) and (per[i][2] < per[i][0] + per[i][1]):
           count += 1
print(count)

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

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

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split(' ')))
lengths = list(itertools.combinations(L, 3))
count = 0
for tri in lengths:
    tri = list(tri)
    tri.sort()
    if (tri[0]+tri[1]>tri[2]) and (tri[0]!=tri[1]) and (tri[1]!=tri[2]) and (tri[0]!=tri[2]):
        count+=1
print(count)

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

cnt = 0

if len(M) >= 3:
  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[j] >  L[k]:
          cnt += 1
print(cnt)

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

import itertools

cnt=0

for pair in itertools.combinations(L, 3):
    lis = sorted(list(pair))
    max_value=lis[2]
    mid_value=lis[1]
    min_value=lis[0]
    if (max_value < mid_value+min_value) and (max_value>mid_value>min_value):cnt+=1

print(cnt)

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

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

Solution (Python):
num = int(input())
lists = list(map(int, list(input().split())))
sets = list(set(lists))
lensets = len(sets)

total = 0

for i in range(lensets):
  for j in range(i+1, lensets):
    for k in range(j+1, lensets):
      
      
      if (sets[i] + sets[j] > sets[k]) and (sets[j] + sets[k] > sets[i]) and (sets[k] + sets[i] > sets[j]):
        
        
        number = lists.count(sets[i]) * lists.count(sets[j]) * lists.count(sets[k])
        
        total += number
print(total)

Solution (Python):
def resolve():
    n = int(input())
    L = sorted(list(map(int, input().split())))
    cnt = 0
    checker = [[[0 for i in range(n)] for j in range(n)] for k in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                if (i < j < k) and (L[i] != L[j] and L[i] != L[k] and L[j] != L[k]) and L[i] + L[j] > L[k]:
                    cnt += 1

    print(cnt)

resolve()

Solution (Python):
import itertools

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

count=0
y=[]

for x in itertools.combinations(a, 3):
  if (x[0]==x[1] or x[0]==x[2] or x[1]==x[2]):
    pass
  else:
    if(x[0]+x[1]>x[2] and x[0]+x[2]>x[1] and x[1]+x[2]>x[0]):
      count+=1
    else:
      pass

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

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

l.sort(reverse=True)
c=0

for x in range(0,n-2):
    max1=l[x]
    for y in range(x+1,n-1):
        max2=l[y]
        for z in range(y+1,n):
            max3=l[z]

            if(max1<max2+max3 and max1!=max2 and max2!=max3):
                c+=1

print(c)

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


print(Ans)

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

count=0

for i, first in enumerate(unique_vals):
    for j, second in enumerate(unique_vals[i+1:]):
        for third in unique_vals[i+j+2:]:
            if third > first - second:
                count+=1*L.count(first)*L.count(second)*L.count(third)
                
                
            else:
                break
print(count)

Solution (Python):
n = int(input())
L = input().split()
L.sort()
count = 0
if n<=2:
    print(0)
    exit()
    
for i in range(n):
  for j in range(i + 1,n):
    for k in range(j + 1 ,n):
        if ((int(L[k]) < int(L[i]) + int(L[j])) & (L[k] != L[i])& (L[k] != L[j])& (L[j] != L[i]) & (abs(int(L[i]) - int(L[j])) < int(L[k]))):
            count += 1
        
print(count)

Solution (Python):
n=int(input())
l=input().split()
r=0
if n<3:
  print(0)
else:
  for x in range(n):
    l[x]=int(l[x])

  for i in range(n):
    a=l[i]
    for j in range(n-i-1):
      y=i+j+1
      b=l[y]
    
      for k in range(n-y-1):
        if a<b:
          d=a
          a=b
          b=d
        c=l[k+y+1]
        if a<c:
          f=a
          a=c
          c=b
          b=f
        elif b<c:
          f=b
          b=c
          c=f
        if b+c>a and a-b<c and a!=b and b!=c:
          r=r+1
          
        a=l[i]
        b=l[y]
        c=l[k+1]
  print(r)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
cnt=0

for i in range(N):
    for j in range(N):
        for k in range(N):
            a=[]
            if A[i]!=A[j] and A[i]!=A[k] and A[j]!=A[k]:
                if i<j and j<k:
                    a.append(A[i])
                    a.append(A[j])
                    a.append(A[k])
                    a.sort()
                    
                    if a[1]-a[0]<a[2] and a[2]<a[0]+a[1]:
                        cnt+=1
print(cnt)

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

Solution (Python):

"""
Created on Sat Aug 15 17:00:46 2020

@author: saito
"""






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


cnt = 0
if N >= 3:
    for i in range(len(L)-2):
        for j in range(i+1, len(L)-1):
            for k in range(j+1, len(L)):
                a = [L[i], L[j], L[k]]
                if len(set(a)) < len(a):
                    continue
                ami = a.index(max(a))
                am = a.pop(ami)
                if am < sum(a):
                    cnt += 1



print(cnt)

Solution (Python):
import itertools

n=int(input())

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

count=0

for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        for k in range(j+1,len(l)):
            
            a=l[i]
            b=l[j]
            c=l[k]
            if abs(a-b)<c and c<a+b:
                if a!=b and b!=c and c!=a:
                    count+=1

print(count)

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



def is_triangle(a, b, c):
	nums = []
	if a > b:
		if a > c:
			n_max = a
			nums = [b, c]
		else:
			n_max = c
			nums = [a, b]
	elif b > c:
		n_max = b
		nums = [a, c]
	else:
		n_max = c
		nums = [a, b]
	return(n_max < sum(nums))

ans = 0
for i in range(n):
	for j in range(i + 1, n):
		for k in range(j + 1, n):
			num_1 = s[i]
			num_2 = s[j]
			num_3 = s[k]
			if (num_1 == num_2) or (num_1 == num_3) or (num_2 == num_3):
				continue
			if is_triangle(num_1, num_2, num_3):
				ans += 1
print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] 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())
if n<3:
  print(0)
else:
  cnt=0
  l_list=list(map(int,input().split()))
  sl_list=sorted(l_list)
  for i in range(n):
    for j in range(i+1,n):
      for g in range(j+1,n):
        m=sl_list[i]
        f=sl_list[j]
        d=sl_list[g]
        if m!=f and f!=d and d!=m:
          if d<m+f:
            cnt+=1
  print(cnt)

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

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


SL = L
SL.sort()

anss = set()
for ix in range(len(SL)):
    for jx in range(ix+1,len(SL)):
        for ux in range(jx+1,len(SL)):
            if SL[ix] != SL[jx] != SL[ux] and SL[ix]+SL[jx] > SL[ux]:
                anss.add((ix+1, jx+1, ux+1))

print(len(anss))

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

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())

L = [int(x) for x in stdin.readline().rstrip().split()]

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

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

ans=0
ijk=it.combinations(range(N),3)
for ls in ijk:
    [i,j,k]=list(ls)
    li=llist[i]
    lj=llist[j]
    lk=llist[k]
    lll=[li,lj,lk]
    
    if li==lj or li==lk or lj==lk:
        pass
    elif max(lll)<sum(lll)-max(lll):
        ans+=1
    
    
print(ans)

Solution (Python):


import itertools

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

L = sorted(L,reverse=True)

M = list(itertools.combinations(L, 3))




c = 0
for i,j,k in M:
    
    
    if i!=j and j !=k and i < j+k:
        
        c += 1
        
print(c)

Solution (Python):
n=int(input())
a=[s for s in input().split()]
a=[int(s) for s in a]
a=sorted(a)
ans=0
def nini(e,f,g):
    b=[e,f,g]
    b=sorted(b)
    h=b[1]
    return h
for i in range(n):
    for j in range(n):
        for k in range(n):
            if a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i]:
                if max(a[i],a[j],a[k])<min(a[i],a[j],a[k])+nini(a[i],a[j],a[k]):
                    ans+=1
print(int(ans/6))

Solution (Python):

numList = []
result = []

user = int(input())
user2 = list(map(int, input().split()))
count = 0

for i in range(user - 2):
    for j in range(user - i - 1):
        jIndex = j + i + 1
        for k in range(user - jIndex - 1):
            kIndex = k + jIndex + 1
            if user2[i] != user2[jIndex] and user2[i] != user2[kIndex] and user2[jIndex] != user2[kIndex]:
                dum = []
                dum.append(user2[i])
                dum.append(user2[jIndex])
                dum.append(user2[kIndex])
                dum.sort()

                if dum[2] < dum[1] + dum[0]:
                    count += 1
print(count)

Solution (Python):
import collections

if __name__ == "__main__":
    N = int(input())
    L = list(map(int, input().split()))

    set_L = list(set(L))
    set_L.sort()
    count_L = collections.Counter(L)

    count = 0
    for i in range(len(set_L)):
        for j in range(i+1, len(set_L)):
            for k in range(j+1, len(set_L)):
                if set_L[i] + set_L[j] > set_L[k]:
                    count = count + count_L[set_L[i]] * count_L[set_L[j]] * count_L[set_L[k]]

    print(count)

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

for i in range(n):
  for j in range(i+1,n):
    for h in range(j+1,n):
      if l[i]!=l[j] and l[h]!=l[j] and l[i]!=l[h]:
        a = [l[i],l[j],l[h]]
        
        a.sort()
        if a[0]+a[1]>a[2]:
          
          c+=1
        
print(c)

Solution (Python):


import itertools
N = int(input())
L = input().split()
LS = [int(i) for i in L]
count = 0
itr = list(itertools.combinations(LS, 3))

for s in itr:
    if s[0] + s[1] > s[2] and s[1] + s[2] > s[0] and s[2] + s[0] > s[1] \
        and s[0] != s[1] and s[1] != s[2] and s[2] != s[0]:
        count = count + 1
print(count)

Solution (Python):
from itertools import combinations

n = int(input())
lList = list(map(int, input().split()))
cou = 0
combList = list(map(list, combinations(list(range(n)), 3)))
for [i, j, k] in combList:
    if lList[i] != lList[j] and lList[i]!=lList[k] and lList[j]!=lList[k]:
        if lList[i] + lList[j] > lList[k] and lList[i] + lList[k] > lList[j] and lList[j] + lList[k] > lList[i]:
            cou += 1
print(cou)

Solution (Python):

from collections import Counter

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

L = sorted(L)
cnt = Counter(L)
ans = 0

i = 0
while i < len(L):
    j = i + 1
    if cnt[L[i]] != 1:
        j += cnt[L[i]] - 1
    while j < len(L):
        k = j + 1
        if cnt[L[j]] != 1:
            k += cnt[L[j]] - 1
        while k < len(L):
            a, b, c = L[i], L[j], L[k]
            if (a + b > c) and (b + c > a) and (c + a > b):
                ans += cnt[a] * cnt[b] * cnt[c]
            k += cnt[L[k]]
        j += cnt[L[j]]
    i += cnt[L[i]]

print(ans)

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

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

d = [i for i in range(N)]


L = dict(zip(d,li))



import itertools
x = (list(itertools.combinations(d, 3)))



cnt = 0
num = len(x)
for i in range(num):
    a = L[x[i][0]]
    b = L[x[i][1]]
    c = L[x[i][2]]
   
    if ((a + b >c) and (a+c >b) and (b+c>a)) and (a!=b and b!=c and a!=c):
        cnt = cnt+1
    else:
        pass
    a = 0
    b = 0
    c = 0
    
print(cnt)

Solution (Python):

 

 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy


 











def combination(n,r):
    return int(math.factorial(n)/math.factorial(r)/math.factorial(n-r))
 
N=int(input())
L = list(map(int, input().split()))

L.sort()

if N<=2 or len(Counter(L))<3:
    print(0)
    sys.exit()

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


for i in range(len(tmp)):
    if tmp[i][0] == tmp[i][1] or tmp[i][1] == tmp[i][2] or tmp[i][2] == tmp[i][0] or tmp[i][0] + tmp[i][1] <= tmp[i][2]:
        continue
    else:
        ans += 1

print(ans)

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



for i in L:
    for j in L:
        for k in L:
            if i != j and i != k and j != k:
                if i + j > k and i + k > j and j + k > i:
                    if i > j > k:
                        ans += 1
                        
                    
print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


from itertools import combinations_with_replacement
N = INT()
L = LIST()

C = Counter(L)
S = sorted(set(L))



A = list(combinations(S, 3))

cnt = 0
for a, b, c in A:
    if a != b != c:
        if a + b > c:
            
            
            
            cnt += C[a] * C[b] * C[c]
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[k]<l[i]+l[j] and l[i]!=l[j] and l[j]!=l[k]):
                ans+=1


print(ans)

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

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

P = list(combinations(c.keys(), 3))
cnt = 0
for x, y, z in P:
    if x + y > z and y + z > x and z + x > y:
        cnt += c[x] * c[y] * c[z]

print(cnt)

Solution (Python):
t=int(input())
arr=list(map(int,input().strip().split()))[:t]
arr.sort()
ct=0
for i in range(0,t-2):
    for j in range(i+1,t-1):
        if(arr[i]==arr[j]):
            continue
        x=arr[i]+arr[j]
        for k in range(j+1,t):
            if(arr[k]==arr[j] or arr[k]==arr[i]):
                continue
            if(x>arr[k]):
                ct+=1
print(ct)

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

count = 0
l_set = set()
for i1 in range(len(Ls)):
    for i2 in range(i1+1,len(Ls)):
        for i3 in range(i2+1, len(Ls)):
            l1 = Ls[i1]
            l2 = Ls[i2]
            l3 = Ls[i3]
            if l1 == l2 or l2 == l3 or l1==l3:
                continue
            max_l = max(l1, l2 ,l3)
            if max_l < l1+l2+l3 - max_l:
                if tuple(sorted([l1, l2, l3])) not in l_set:
                    count += 1
print(count)