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())
data = list(map(int, input().split(' ')))

if n < 3:
    print(0)
else:
    import itertools
    cnt = 0
    for d in itertools.combinations(data, 3):
        if d[0] != d[1] and d[1] != d[2] and d[2] != d[0]:
            mx = max(d)
            if mx * 2 - sum(d) < 0:
                cnt += 1
    print(cnt)

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

Solution (Python):





def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return x

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return x

def int_map():
    return map(int,input().split())

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

def print_space(l):
    return print(" ".join([str(x) for x in l]))


import numpy as np




N = int(input())
L = int_list()

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] 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):
import itertools
n = int(input())
L=sorted(list(map(int,input().split())), reverse=True)

ans = 0
'''for i,l in enumerate(L):
	for j,s1 in enumerate(L[i+1:]):
		for k,s2 in enumerate(L[j+1:]):
			if l<s1+s2:
				ans += 1
'''
for i,j,k in itertools.combinations(L, 3):
	l = sorted([i,j,k])
	if l[0]+l[1]>l[2] and l[0]!=l[1]!=l[2]!=l[0]:
		
		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] and l[j]!=l[k]:
                ans+=1
print(ans)

Solution (Python):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    
    L = list(map(int, stdin.readline().rstrip().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]:
                    big = max(L[i],L[j],L[k])
                    s = L[i] + L[j] + L[k]
                    if s-big > big:
                        ans += 1
                else:
                    pass
    print(ans)




if __name__ == '__main__':
    solve()

Solution (Python):
n = int(input())
l = [int(i) for i in 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] or 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()))

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

Solution (Python):
from itertools import combinations

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

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

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

Solution (Python):
def check(li,lj,lk):
    if (li+lj > lk) and (li+lk > lj) and (lj+lk > li):
        return True
    else:
        return False

def main():
    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] and l[i]!=l[k] and l[j]!=l[k] and check(l[i],l[j],l[k]):
                    count += 1

    print(count)
    
if __name__=='__main__':
    main()

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, b, c = L[i], L[j], L[k]
            if a == b or b == c or c == a:
                continue
            elif a + b > c and b + c > a and c + a > b:
                ans += 1
print(ans)

Solution (Python):
N = int(input())
li = list(map(int,input().split()))
li.sort(reverse=True)
c = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1, N):
            if li[i] == li[j] or li[j] == li[k] or li[i] == li[k]:
                continue

            if li[i] < li[j] + li[k]:

                c += 1
print(c)

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 i==j or j==k:
                continue
            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()))

ans = 0
for i in range(n):
    for g in range(i+1, n):
        for m in range(g+1, n):
            a = l[i]
            b = l[g]
            c = l[m]
            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 = [int(x) for x in input().split()]
A.sort()
score=0
for i in range(N):
  for j in range(i,N):
    for k in range(j,N):
      if A[i]!=A[j] and A[j]!=A[k] and A[i]+A[j]>A[k]:
        score+=1
print(score)

Solution (Python):









def solve():
    N = int(input())
    Ls = 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):
                l1 = Ls[i]
                l2 = Ls[j]
                l3 = Ls[k]

                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if l1 + l2 <= l3:
                    continue
                if l2 + l3 <= l1:
                    continue
                if l3 + l1 <= l2:
                    continue
                count += 1
    return count


def main():
    print(solve())


if __name__ == "__main__":
    main()

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

ans = 0
for i in range(N):
    for j in range(i,N):
        if A[i] == A[j]:
            continue
        for k in range(j,N):
            if A[i] == A[k] or A[j] == A[k]:
                continue
            l = [A[i],A[j],A[k]]
            n = sum(l) - 2*max(l)
            if n > 0:
                ans += 1

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    n = int(input())
    L = list(map(int, input().split()))

    ans = 0
    for l in itertools.combinations(L, 3):
        l = list(l)
        l.sort()
        if l[0]!=l[1] and l[1]!=l[2] and l[2]!=l[0]:
            if l[2] < l[0]+l[1]:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

nums.sort()

ans= 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            a, b, c = nums[i], nums[j], nums[k]
            if a < b < c:
                if a + b > c:
                    ans += 1
                
                
print(ans)

Solution (Python):
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = readInts()

ans = 0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			b1 = a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i]
			b2 = a[i]+a[j]>a[k] and a[j]+a[k]>a[i] and a[k]+a[i]>a[j]
			if b1 and b2:
				ans+=1

print(ans)

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

print(c)

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    L = list(map(int, input().split()))
    CNT = 0
    for i in range(N):
        for j in range(i+1,N):
            if L[i] != L[j]:
                for k in range(j+1,N):
                    if L[i] != L[k] and L[j] != L[k]:
                        S = L[i] + L[j] + L[k]
                        M = max(max(L[i], L[j]), L[k])
                        if S - M > M:
                            CNT += 1
    print(CNT)

if __name__ == '__main__':
    main()

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

counter = 0
for l1, l2, l3 in cmb(L, 3):
    
    if l1 + l2 > l3 and l2 + l3 > l1 and l3 + l1 > l2 and l1 != l2 and l2 != l3 and l3 != l1:
        counter += 1
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,N):
        for k in range(j, N):
            if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                sum_edge=L[i]+L[j]+L[k]
                max_edge=max(L[i],L[j],L[k])
                if max_edge<(sum_edge-max_edge):
                    ans+=1

print(ans)

Solution (Python):
num = int(input())
l_i = list(map(int, input().split()))
ans = 0
for i in range(len(l_i)):
    ival = l_i[i]
    for j in range(len(l_i)):
        if j <= i: continue
        jval = l_i[j]
        if ival == jval: continue
        for k in range(len(l_i)):
            if k <= j: continue
            kval = l_i[k]
            if ival == kval or jval == kval: continue
            if ival < jval + kval and jval < ival + kval and kval < ival + jval: ans += 1
print(ans)

Solution (Python):
n = int(input())
lst = [int(i) for i in input().split()]
if n == 1 or n == 2:
  print(0)
else:
  lst.sort()
  
  count = 0
  for i in range(n-2):
    for j in range(i+1, n-1):
      if lst[j] == lst[i]:
        continue
      for k in range(j+1, n):
        if lst[k] == lst[j]:
          continue
        if lst[i] + lst[j] > lst[k]:
          count += 1
  print(count)

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):
    Li, Lj, Lk = sorted([L[i], L[j], L[k]])
    if Li != Lj and Lj != Lk and Lk != Li and Li + Lj > Lk:
        ans += 1

print(ans)

Solution (Python):
import itertools

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

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

Solution (Python):
import sys
from itertools import combinations


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    l = list(map(int, input().split()))
    ans = 0
    for i, j, k in combinations(range(n), 3):
        if (
            abs(l[j] - l[i]) < l[k] != l[i]
            and l[k] < l[i] + l[j]
            and l[i] != l[j]
            and l[k] != l[j]
        ):
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

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

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

Solution (Python):






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





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

Solution (Python):
from itertools import combinations

[N],*li = [list(map(int,i.split())) for i in open(0)]
li = li[0]
count = 0
for k in combinations(li,3):
    k = sorted(list(k))
    if k[2]<k[0]+k[1] and k[0]!=k[1] and k[1]!= k[2]:
        count += 1
print(count)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
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] > 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):
n= int(input())
a = [int(i) for i in input().split()]
ans = 0
a.sort()

for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if a[i]+a[j]>a[k] and len(set([a[i],a[j],a[k]]))==3:
				
				ans+=1
print(ans)

Solution (Python):
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    L = kwargs["L"]
    res = 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 abs(L[i] - L[j]) < L[k] < L[i] + L[j]:
                        res += 1

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]

    cin = input().split()
    kwargs["L"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

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 len({L[i], L[j], L[k]}) < 3:
                continue
            if L[k] < L[i] + L[j] and L[i] < L[j] + L[k] and L[j] < L[k] + L[i]:
                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[i] + l[k] > l[j] and l[k] + l[j] > 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 = sorted(l)
count = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1, n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k] and l[k] < l[i] + l[j]:
                count += 1

print(count)

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

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

for i in X:
    temp = list(sorted(list(i)))
    if temp[0]+temp[1]>temp[2] and len(list(set(temp)))==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):
      S = [L[i], L[j], L[k]]
      S.sort()
      if S[2] < S[0] + S[1] and (S[0] != S[1] and S[1] != S[2] and S[2] != S[0]):
        ans += 1

print(ans)

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

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

a.sort()

ans = 0

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

print(ans)

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

Solution (Python):
import itertools
N  = input()
L =  (map(int, input().split()))
ans = 0
for x, y, z in itertools.combinations(L, 3):
  ans += x + y > z and y+z>x and z+x>y and x != y and y != z and z != x
print(ans)

Solution (Python):
mod = 10**9 + 7
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = 0
    a.sort()
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[i] + a[j] > a[k] and a[i] != a[j] and a[j] != a[k]:
                    ans += 1
    print(ans)
t = 1
while t > 0:
    solve()
    t -= 1

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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue
from functools import reduce

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	N = inputInt()
	L = inputList()

	L.sort()

	ans = 0
	for aa in range(N):
		a = L[aa]
		for bb in range(aa+1,N):
			b = L[bb]
			for cc in range(bb+1,N):
				c = L[cc]
				if a == b or a == c or b == c:
					continue
				if abs(a-b) < c and c < a+b:
					
					ans += 1
	print(ans)




if __name__ == "__main__":
	main()

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

print(count)

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

ans = 0
l = sorted(l)
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()))
if n<3:
    print(0)
    exit()
cnt = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            alist = sorted(list(set([l[i],l[j],l[k]])))
            if len(alist)== 3:
                if alist[2] < alist[0]+alist[1]:
                    cnt += 1
print(cnt)

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

Solution (Python):

import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
L = list(map(int,readline().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] > L[k] and L[i]!=L[j] and 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-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[j]-l[i] < l[k] < l[i]+l[j]:
                    ans += 1

print(ans)

Solution (Python):




n = int(input())
l = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
    for j in range(i,n-1):
        for k in range(j,n):
            if(l[i] != l[j] and l[j] != l[k] and l[k] != l[i]):
                if(l[i] + l[j] + l[k] > 2 * max(l[i],l[j],l[k])):
                    count += 1

print(count)

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

Solution (Python):
from itertools import combinations


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



N = int(input())
L = list(map(int, input().split()))
L.sort()
res = 0
for a, b, c in combinations(L, 3):
    if a != b != c and ok(a, b, c):
        res += 1
print(res)

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

Solution (Python):
from collections import defaultdict

N = int(input())
arr = list(map(int, input().split(" ")))
stick = defaultdict(int)
for c in arr :
    stick[c] += 1 

s = sorted(list(stick.keys()))

n = len(s)
res = 0
for i in range(n) :
    for j in range(i+1, n) :
        v = stick[s[i]]*stick[s[j]]
        for k in range(j+1, n) :
            if s[i]+s[j] <= s[k] : 
                continue
            res += v*stick[s[k]]
print(res)

Solution (Python):
n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
if n < 3:
    print(ans)
    exit()
for i in range(n):
    for j in range(i+1, n):
        if ll[i] == ll[j]:
            continue
        for k in range(j+1, n):
            if ll[j] == ll[k]:
                continue
            if ll[i]+ll[j] > ll[k]:
                ans += 1


print(ans)

Solution (Python):
N = int(input())
ls = 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):
            check = [ls[i],ls[j],ls[k]]
            point = {ls[i],ls[j],ls[k]}
            t = max(check)
            if len(point)==3:

                if sum(check)-t >t:
                    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):
        for k in range(j):
            if (max(L[i],L[j],L[k]) * 2 < L[i] + L[j] + L[k]) and (L[i] != L[j]) and(L[j] != L[k])and(L[k] != L[i]):
                ans += 1
print(ans)

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

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

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





N = getN()
L = getList()

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

Solution (Python):
N = int(input())
length = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if length[i]<length[j]+length[k] and length[j] < length[i] + length[k] and length[k] < length[j] + length[i]:
                if length[i]!=length[j] and length[i]!= length[k] and length[j]!=length[k]:
                    ans += 1
print(ans//6)

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

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):
            T = [L[i], L[j], L[k]]
            T.sort()
            if T[0] != T[1] and T[1] != T[2]:
                if T[2] < T[0]+T[1]:
                    ans += 1
print(ans)

Solution (Python):
from itertools import combinations

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

ans = 0
for c in combinations(l, 3):
    if len(set(c)) == 3 and sum(c) - max(c) > max(c):
        ans += 1
print(ans)

Solution (Python):
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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