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())
hen = []

hen = list(int(x) for x in input().split())
hen.sort()



tri = 0

for a in hen:
    for b in hen:
        if(a == b)or (a > b):
            continue
        for c in hen:
            if(a == c)or(b == c) or (a > c) or (b > c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

Solution (Python):
def A():
    s = input()
    if s == 'SSS': print(3)
    elif s=='RSS' or s=='SSR': print(2)
    elif s=='RRR': print(0)
    else: print(1)

def B():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            if a[i] == a[j]: continue
            for k in range(j+1, n):
                if a[i]==a[k] or a[j] == a[k]: continue
                s = a[i] + a[j] + a[k]
                if s > 2 * max(a[i], a[j], a[k]):
                    cnt += 1
    print(cnt)

def C():
    x, k, d = map(int, input().split())
    if abs(x) > k * d:
        print(abs(x) - k*d)
    else:
        tm = abs(x) // d
        x = abs(x) % d
        k -= tm
        if k % 2 == 0:
            print(x)
        else:
            print(d-x)
B()

Solution (Python):























import math
import copy
import string



INF = int(10**18) 
pi = math.pi

MOD = 1000000007








def my_pow(N, a, M):
    if(a == 0):
        return 1
    else:
        if(a % 2 == 0):
            tempo = my_pow(N, a/2, M)
            return (tempo * tempo) % M
        else:
            tempo = my_pow(N, a - 1, M)
            return (tempo * N) % M





def my_combination(N, a, M):
    res = 1

    for i in range(0, a):
        res *= N - i
        res %= M

    for i in range(0, a):
        res *= my_pow(i + 1, M - 2, M)
        res %= M

    return res





def my_combination_table(N, M, v):
    if(len(v) < N + 1):
        l = N + 1 - len(v)
        tempo = [1] * l
        v.extend(tempo)

    for i in range(1, N + 1):
        v[i] = v[i - 1] * (N - (i - 1))
        v[i] %= M

        v[i] *= my_pow(i, M - 2, M)
        v[i] %= M

    return









N = int(input())
L =[int(x) for x in input().split()]

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

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

cnt = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] == L[j] or 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()))

count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        
        if l[j]!=l[i]:
            
            for k in range(j+1,n):
                a,b,c=[l[i],l[j],l[k]]
                if 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())
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()
cnt=0
for i in range(n):
 for j in range(i):
  for k in range(j):
   if l[k]!=l[j] and l[i]!=l[j] and l[k]+l[j]>l[i]:
    cnt+=1
print(cnt)

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

Solution (Python):
N = int(input())
count = 0
L = list(map(int, input().split()))
for i,li in enumerate(L[:-2]):
  for j,lj in enumerate(L[i+1:-1]):
    for k,lk in enumerate(L[i+j+1:]):
      if (li != lj) and (lj != lk) and (li != lk):

        if li + lj > lk and lj + lk > li and lk + li > lj:

          count += 1
print(count)

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

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):
      li = [l[i], l[j], l[k]]
      
      m = max(li)
      if 2*m < sum(li) and len(set(li)) == 3:
        ans += 1
print(ans)

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

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

Solution (Python):
from itertools import combinations

N = int(input())
a = list(map(int, input().split()))
count = 0
for i in combinations(a,3):
    b = list(i)
    b.sort()
    if b[2] > b[1] and b[1] > b[0]:
        if b[2] < (b[1] + b[0]):
            count += 1

print(count)

Solution (Python):
import itertools
import sys
N = int(input())
if N < 3:
  print(0)
  sys.exit()
 

hen_list = input().split()
for i in range(len(hen_list)):
    hen_list[i] = int(hen_list[i])
 

count = 0
for tri in itertools.combinations(hen_list, 3):
    sort_tri = sorted(tri)
    if sort_tri[0] + sort_tri[1] > sort_tri[2]:
        if tri[0] != tri[1] and tri[0] != tri[2] and tri[1] != tri[2]:
            
            count += 1
print(count)

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

ans = 0

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

print(cnt)

Solution (Python):
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations
def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
from itertools import combinations 
l_=list(map(int,input().split()))

l=list(combinations(l_,3))

cnt=0
for i in range(len(l)):
  
  if len(list(set(l[i])))==len(l[i]):
    
    if max(l[i])<sum(l[i])-max(l[i]):
      cnt+=1
      
print(cnt)

Solution (Python):
import math
import collections
import itertools

def YesNo(Bool):
    if(Bool):
        print("Yes")
    else:
        print("No")
    return

def resolve():

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

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

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

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

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

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

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

print(ans)

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

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

Solution (Python):
from itertools import combinations
n = int(input())
l = list(map(int, input().split()))

ans = 0
for i,j,k in combinations(l,3):
  if i == j or i == k or j == k: continue
  if i >= j+k or j >= i+k or k >= i+j: continue
  ans += 1
print(ans)

Solution (Python):
import itertools
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
ans=0
N=II()
L=LI()
c = itertools.combinations(L, 3)
for v in itertools.combinations(L, 3):
    v=list(v)
    v.sort()
    if v[0]==v[1] or v[1]==v[2]:
      continue
    if v[0]+v[1]>v[2]:
      ans+=1
print(ans)

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


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = Counter(L)
    key = count.keys()

    set_list = combinations(key, 3)
    answer = 0
    for s in set_list:
        a = s[0]
        b = s[1]
        c = s[2]
        if (a + b) > c and (b + c) > a and (c + a) > b:
            answer += count[a] * count[b] * count[c]
    print(answer)


if __name__ == "__main__":
    main()

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

ans = 0
if N > 2:
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                tmp = [L[i], L[j], L[k]]
                if (len(tmp) == len(set(tmp))) and (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):
import numpy as np
from numba import *


N = int(input())
length = np.array(input().split(), np.int64)


length = np.sort(length)


def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)

Solution (Python):
import numpy as np
from numba import *


N = int(input())
length = np.array(input().split(), np.int64)


length = np.sort(length)

@njit
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)

Solution (Python):

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

li.sort()

ans = 0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if li[i] != li[j] != li[k]:
                if li[i] + li[j] > li[k]:
                    ans += 1
print(ans)

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

answer = 0
for idx1 in range(0, len(arr) - 2):
    for idx2 in range(idx1+1, len(arr) - 1):
        for idx3 in range(idx2+1, len(arr)):
            if arr[idx1] == arr[idx2] or arr[idx1] == arr[idx3] or arr[idx2] == arr[idx3]:
                continue
            if arr[idx1] + arr[idx2] > arr[idx3] and arr[idx1] + arr[idx3] > arr[idx2] and arr[idx2] + arr[idx3] > arr[idx1]:
                answer += 1

print(answer)

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

Solution (Python):
import itertools

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

combinations = list(itertools.combinations(range(N), 3))

count = 0
for cmb in combinations:
    flag = True
    for i in range(3):
        if L[cmb[i]] + L[cmb[(i + 1) % 3]] > L[cmb[(i + 2) % 3]] and L[cmb[i]] != L[cmb[(i + 1) % 3]]:
            continue
        else:
            flag = False
            break
    if flag:
        count += 1

print(count)

Solution (Python):
import sys
sys.setrecursionlimit(300000)
from itertools import combinations

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
L = LMI()

ans = 0
for a, b, c in combinations(L, 3):
    if a == b or b == c or c == a:
        continue
    if a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

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

Solution (Python):
from itertools import combinations

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

ans = 0
for i, j, k in combinations(range(N),3):
  ell = sorted([L[i], L[j], L[k]])
  if ell[2] < ell[0] + ell[1] and len(set(ell)) == 3:
    ans += 1
print(ans)

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

Solution (Python):
from itertools import combinations
N = int(input())
nums = list(map(int,input().split()))
tcount = 0
numset = set(nums)
comb = combinations(numset,3)
for i in list(comb):
	a = i[0]
	b = i[1]
	c = i[2]
	if(a+b>c and b+c>a and a+c>b):
		tcount += nums.count(a)*nums.count(b)*nums.count(c)
print(tcount)

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

Solution (Python):
num = int(input())
nums = input().split()
nums = [int(x) for x in nums]
nums = sorted(nums)
count = 0

for i in range(len(nums)-2):
  num1 = nums[i]

  for j in range(len(nums)-2-i):
    num2 = nums[j+i+1]

    for k in range(len(nums)-2-i-j):
      num3 = nums[k+j+i+2]
      
      if (num1 + num2) > num3 and num1 < num2 and num2 < num3:
        count += 1
        
      

print(count)

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

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

Solution (Python):
from itertools import combinations

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

ans = 0

for a, b, c in combinations(L, 3):
    if a == b or b ==c or a == c:
        continue
    if a + b + c - max(a, b, c) > max(a, b, c):
        ans += 1

print(ans)

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

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

le = len(L)

score = 0

for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)

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

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

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

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]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j] and l[i]!=l[j] and l[i]!=l[k] and l[j]!=l[k]:
                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(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):
N = int(input())
l = list(map(int,input().split()))
ans = 0
if N < 3 :
    ans = ans
else :
    for m in range(N-2) :
        for n in range(m+1,N-1) :
            for k in range(n+1,N) :
                if len(set([l[m],l[n],l[k]])) == 3 and 2 * max(l[m],l[n],l[k]) < sum([l[m],l[n],l[k]]) :
                    ans += 1
                else :
                    continue
print(ans)

Solution (Python):
import itertools
import sys
N = int(input())
if N < 3:
  print(0)
  sys.exit()


hen_list = input().split()
for i in range(len(hen_list)):
    hen_list[i] = int(hen_list[i])


count = 0
for tri in itertools.combinations(hen_list, 3):
    sort_tri = sorted(tri)
    if sort_tri[0] + sort_tri[1] > sort_tri[2]:
        if tri[0] != tri[1] and tri[0] != tri[2] and tri[1] != tri[2]:
            
            count += 1
print(count)

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

if(n<3):
    print(0)
    exit()
l.sort(reverse=True)
ln = len(l)
cnt = 0
for i in range(ln):
    for j in range(i+1,ln):
        for k in range(j+1,ln):
            a,b,c = l[i],l[j],l[k]
            if(a==b or b==c or a==c):
                continue
            if(a<(b+c)):
                cnt += 1

print(cnt)

Solution (Python):
n = int(input())
line = input().split()

length = [int(line[i]) for i in range(n)]
length.sort(reverse = True)

count = 0

for i in range(n-2):
  long = length[i]
  
  for j in range(i+1,n-1):
    middle = length[j]
    if middle == long:
      continue
    if middle*2 <= long :
      break
      
    for k in range(j+1,n):
      short = length[k]
      if short == middle:
        continue
      if short + middle > long:
        count += 1
      else:
        break

print(count)

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

count = 0

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

print(count)

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

Solution (Python):


from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int, L: "List[int]"):
    L.sort()
    return sum(L[i] not in [L[j], L[k]] and L[j] != L[k] and L[i] + L[j] > L[k] for i in range(N) for j in range(i+1, N) for k in range(j+1, N))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    L = [int(next(tokens)) for _ in range(N)]  
    print(f'{solve(N, L)}')


if __name__ == '__main__':
    main()

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]:
            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 = [int(x) for x in input().split()]
s = [0, 0, 0]
count=0

l.sort()

for i in range(len(l)):
    for j in range(len(l)):
        for k in range(len(l)):
            if i == j or j == k or k==i:
                pass
            else:
                if l[i] >= l[j] or l[j] >= l[k] or l[k] <= l[i]:
                    pass
                else:
                    s[0] = l[i]
                    s[1] = l[j]
                    s[2] = l[k]
                  
                    if s[2] < s[1] + s[0]:
                        count += 1
                    else:
                        pass

print(count)

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

print(ans)

Solution (Python):
n=int(input())
M=list(map(int,input().split()))
M.sort()
dic={}
dic[M[0]]=1
for i in range(1,n):
	if(M[i]!=M[i-1]):
		dic[M[i]]=1
	else:
		dic[M[i-1]]+=1

L=list(dic.keys())
l=len(L)
L.sort()
count=0
for i in range(0,l):
	for j in range(0,i):
		for k in range(0,j):
			if(L[i]<L[j]+L[k]):
				count+=dic[L[i]]*dic[L[j]]*dic[L[k]]
print(count)

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

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

for i in range(len(l_list)):
    for j in range(i + 1, len(l_list)):
        for k in range(j + 1, len(l_list)):
            if l_list[i] + l_list[j] > l_list[k] \
                    and l_list[i] != l_list[j] \
                    and l_list[j] != l_list[k] \
                    and l_list[k] != l_list[i]:
                ans += 1
print(ans)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    N = int(readline())
    L = [int(i) for i in readline().split()]
    
    
    L.sort()
    cnt = 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]:
                    if (L[i] != L[j]) & (L[j] != L[k]) & (L[k] != L[i]):
                        cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Solution (Python):
import itertools

n = int(input())
l = list(map(int, input().split()))
p_list = list(itertools.permutations(l, 3))
results = [x for x in p_list if max(x) < (sum(x) - max(x)) and len(x) == len(set(x))]
print(int(len(results) / 6))

Solution (Python):
import itertools

def main(L):
    ans = 0
    for pair in itertools.combinations(L, 3):
        if len(set(pair)) < 3:
            continue
        lines = list(pair)
        a = max(lines)
        lines.remove(a)
        b, c = lines
        if a < b + c:
            ans += 1
    return ans

if __name__ == '__main__':
    N = int(input())
    L = list(map(int, input().split()))
    ans = main(L)
    print(ans)

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

Solution (Python):


N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        for k in range(j+1,len(A)):
            if A[i] + A[j] > A[k] and A[j] + A[k] > A[i] and A[k] + A[i] > A[j] and A[i] != A[j] and A[j] != A[k] and A[k] != A[i] :
                ans += 1
print(ans)

Solution (Python):
from collections import defaultdict

n = int(input())
l_list = [int(x) for x in input().split()]

d = defaultdict(int)
for l in l_list:
    d[l] += 1

n = len(d)
l_list = sorted(d.keys())
ans = 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 = l_list[i], l_list[j], l_list[k]
            if a + b <= c:
                continue
            ans += d[a] * d[b] * d[c]
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]:
                continue
            if l[j] == l[k]:
                continue
            if l[i] == l[k]:
                continue
            if max(l[i], l[j], l[k]) * 2 < l[i] + l[j] + l[k]:
                ans += 1

print(ans)

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

print(ans)

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

Solution (Python):
from itertools import combinations

N = int(input())
L = list(map(int, input().split()))
ans = 0
for v in combinations(L, 3):
    if len(set(v)) == 3:
        a, b, c = v
        if a + b > c and c + a > b and b + c > a:
            ans += 1
print(ans)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1,n):
            l1 = l[i]
            l2 = l[j]
            l3 = l[k]
            if (l1 != l2) &(l2 != l3)&(l1 + l2 > l3):
                count += 1
print(count)