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

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

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

print(ans)

Solution (Python):
def check(i,j,h):
    return i!=j and j!=h and h!=i and i+j>h and j+h>i and i+h>j

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

ans = 0
for i in range(N):
    for j in range(i,N):
        for h in range(j,N):
            ans += check(L[i],L[j],L[h])

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
enum = enumerate
inf = 1001001001

import collections
import random

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

def lcm(a: int, b: int):
	return a * b // gcd(a, b)

def dist(x1,y1,x2,y2):
	return abs(x1-x2)+abs(y1-y2)

def ran():
	vRan = [random.randint(1,5) for i in range(8)]
	return vRan

def bye(res):
	sT = "No Yes".split()
	print(sT[res])
	

def main():
	N, = linput()
	vL = linput()
	
	res = 0
	if N<3: print(res); return

	for i,a in enum(vL[0:]):
		for j,b in enum(vL[i+1:]):
			if a==b: continue
			for k,c in enum(vL[i+j+1:]):
				if a==c or b==c: continue
				p,q,r = sorted([a,b,c])
				if not(p+q<=r):
					res += 1

	print(res)
	

if __name__ == "__main__":
	main()

Solution (Python):
import collections


def main():
    n = int(input())
    L = sorted(list(map(int, input().split())))
    counter = collections.Counter(L)
    keys = list(counter.keys())
    lenKeys = len(keys)
    if lenKeys < 3:
        print(0)
        return
    cnt = 0
    for a in range(lenKeys - 2):
        for b in range(a + 1, lenKeys - 1):
            for c in range(b + 1, lenKeys):
                if keys[a] + keys[b] > keys[c]:
                    cnt += counter[keys[a]] * \
                        counter[keys[b]] * counter[keys[c]]
    print(cnt)


if __name__ == '__main__':
    main()

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

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

def li():
    return [int(x) for x in input().split()]

N = int(input())
L = li()


com = it.combinations(L, 3)
com_list = list(com)

cnt = 0
for l in com_list:
    unique_l = len(set(l))
    if unique_l != 3:
        continue
    a, b, c = l[0], l[1], l[2]
    if a < b + c and b < c + a and c < a + b:
        cnt += 1

print(cnt)

Solution (Python):
import sys
import math
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
e = 0

for i in range(len(L)):
    s = 0
    s = L[i]
    for j, b in enumerate(L[i+1:]):
        if L[i] == b:
            continue
        g = s + b
        for w, n in enumerate(L[i+j+2:]):
            if n == b or n == L[i]:
                continue

            a = g - n
            if a > 0:
                e += 1

print(e)

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

Li = L.split(' ')
Li = map((lambda x: int(x)), Li)
L = [i for i in Li]

if len(L) < 3:
    L = [0,0,0]

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

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

Li = L.split(' ')
Li = map((lambda x: int(x)), Li)
L = [i for i in Li]

if len(L) < 3:
    L = [0,0,0]

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

Solution (Python):
import sys


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


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

    L.sort()
    count = 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]:
                    if L[i] + L[j] > L[k]:
                        count += 1
                    else:
                        break

    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
import itertools

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

count = 0

for triple in itertools.combinations(ary_L, 3):
    l = list(triple)
    l.sort()
    a, b, c = l
    if a != b and a != c and b != c and (a + b > c):
        count += 1

print(count)

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

Solution (Python):
n = int(input())
lis = [int(x) for x in input().split()]
lis.sort()
nas = 0
ans = 0
for i in range(n-2):
  for y in range(i+1, n-1):
    for z in range(y+1,n):
      if lis[i] != lis[y] and lis[y] != lis[z] and lis[i] != lis[z] and lis[i]+lis[y] > lis[z]:
        ans += 1

print(ans)

Solution (Python):
from itertools import *
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i,j,k in combinations(a,3):
    if i<j<k and i+j>k:
      ans+=1
print(ans)

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

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

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

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

Solution (Python):
from itertools import *
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i,j,k in combinations(a,3):
    if i<j<k and i+j>k:
      ans+=1
print(ans)

Solution (Python):
from itertools import *
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i,j,k in combinations(a,3):
    if i<j<k and i+j>k:
      ans+=1
print(ans)

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] != L[i] and L[i]+L[j]+L[k] > 2*max(L[i], L[j], L[k]):
                cnt += 1

print(cnt)

Solution (Python):
import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
    return int(input())
def rm():
    return map(int,input().split())
def rl():
    return list(map(int,input().split()))

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

Solution (Python):
from itertools import combinations

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

for li, lj, lk in combinations(l, 3):
    if li < lj < lk < li + lj:
        ans += 1
print(ans)

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
l.sort()
ans=0
 
 
for i in range(2,n):
    for j in range(1,i):
        for k in range(j):
            if l[k]==l[j] or l[i]==l[j] or l[i]==l[k]:
                continue
            x=l[k]+l[j]
 
            if x > 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[j]!=l[k] and l[k]!=l[i] and 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):
def main():
    from itertools import combinations

    _ = int(input())
    *L, = map(int, input().split())
    L.sort(reverse=True)

    cnt = 0
    for comb in combinations(L, r=3):  
        cond = all([
            len(set(comb)) == 3,
            sum(comb) - comb[0] * 2 > 0
        ])
        if cond:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from itertools import combinations

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    _ = int(rl())
    L = list(map(int, rl().split()))
    L.sort()
    ans = 0
    for li, lj, lk in combinations(L, 3):
        ans += li < lj < lk < li + lj
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
def main():
    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 = l[i]
                b = l[j]
                c = l[k]
                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)
main()

Solution (Python):


import sys
input=sys.stdin.readline

n=int(input())
arr=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):
            tmp=[arr[i],arr[j],arr[k]]
            tmp=sorted(tmp)
            s=set(tmp)
            if len(s)==3 and tmp[0]+tmp[1]>tmp[2]:
                ans+=1
print(ans)

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

cnt=0

for i in range(len(l)):
    for j in range(len(l)):
        for k in range(len(l)):
            if l[i]<l[j]<l[k]:
                if l[k]<l[i]+l[j]:
                    cnt+=1


print(cnt)

Solution (Python):
import itertools

N = int(input())
L = list(map(int, input().split()))
cnt = 0
for tri in itertools.combinations(L, 3):
    if max(tri) < sum(tri) - max(tri) and tri[0] != tri[1] and tri[0] != tri[2] and tri[1] != tri[2]:
        cnt += 1
print(cnt)

Solution (Python):

import sys

def main():
    import itertools
    input = sys.stdin.readline
    _ = int(input())
    l = list(map(int, input().split()))
    ans = 0
    for i in itertools.combinations(l, 3):
        if len(set(i)) == 3 and abs(i[0] - i[1]) < i[2] < i[0] + i[1]:
            ans += 1
    print(ans)




if __name__ == '__main__':
    main()

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 len({l[i], l[j], l[k]}) != 3:
                continue
            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 = [*map(int, input().split())]
L.sort()
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[j] == L[k]: continue
            if L[k] == L[i]: continue
            if L[i] + L[j] > L[k]: c += 1
print(c)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
M = sorted(L, reverse=True)
u = 0
c = [0]*3
for i in range(N):
  for j in range(i,N):
    for k in range(j,N):
      if(L[k]<L[i]+L[j] and L[i] < L[k]+L[j] and L[j]<L[i] + L[k] and
         (not(L[i]==L[j])) and (not(L[j]==L[k])) and (not(L[i]==L[k]))):
        u+=1
print(u)

Solution (Python):
import itertools

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

count = 0

for pattern in itertools.combinations(L, 3):
    if len(set(pattern)) == len(pattern):
        if max(pattern) < (sum(pattern) - max(pattern)):
            count += 1

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):
        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 and b!=c and c!=a):
                    if max(a,b,c)<(sum([a,b,c])-max(a,b,c)):
                        ans+=1
    print(ans)

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

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

l_sort = sorted(L)
cnt = 0

for i in l_sort:
    for j in l_sort:
        for k in l_sort:
            if i >= j or i >= k or j >= k: continue
            if i + j <= k: continue
            cnt+=1
print(cnt)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
L =LI()
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[j] != L[k] and L[i] != L[k] and abs(L[j] - L[k]) < L[i] < L[j] + L[k]:
                cnt += 1
print(cnt)

Solution (Python):
n = int(input())
L = [*map(int, input().split())]
M = {}
for l in L:
    if l in M: M[l] += 1
    else: M[l] = 1
M = list(M.items())
M.sort()
m = len(M)
c = 0
for i in range(m):
    for j in range(i+1, m):
        for k in range(j+1, m):
            if M[i][0]+M[j][0] > M[k][0]:
                c += M[i][1] * M[j][1] * M[k][1]
print(c)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
res = 0
for i in range(n):
  for j in range(i + 1, n):
    for k in range(j + 1, n):
      if len(set([a[i], a[j], a[k]])) < 3:
        continue
      if a[i] + a[j] > a[k]:
        res += 1
print(res)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if a[i]+a[j] > 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]:
                    cnt += 1
    print(cnt)


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):
        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()))
res = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            longest = max(L[i], L[j], L[k])
            if longest*2 < L[i] + L[j] + L[k] and len(set([L[i], L[j], L[k]])) == 3:
                res += 1
print(res)

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

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

Solution (Python):


import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union































def main():
    Num = Union[int, float]
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input():  return sys.stdin.readline().rstrip()
    def ii():     return int(input())
    def isp():    return input().split()
    def mi():     return map(int, input().split())
    def mi_0():   return map(lambda x: int(x)-1, input().split())
    def lmi():    return list(map(int, input().split()))
    def lmi_0():  return list(map(lambda x: int(x)-1, input().split()))
    def li():     return list(input())
    def debug(x): print(x, file=sys.stderr)
    
    
    
    
    n = ii()
    L = lmi()
    cnt = 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 and b != c and c != a and abs(b - c) < a < b + c:
                    cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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

Solution (Python):
from bisect import bisect_left, bisect_right
n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for j in range(n):
    for k in range(j + 1, n):
        if l[j] == l[k]:
            continue

        ans += max(bisect_left(l, l[j]) - bisect_right(l, l[k] - l[j]), 0)

print(ans)

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

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

print(t)

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

Solution (Python):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
INT_MIN=-10**13
import bisect as B

n=int(input())
A=INPUT()
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[k])>A[j] and (A[j]+A[k])>A[i] and A[i]!=A[j] and A[i]!=A[k] and A[j]!=A[k]:
                ans+=1
                
print(ans)

Solution (Python):
a=input()
b=input()
c=b.split(" ")
for i in range( len(c)):
  c[i]=int(c[i])
count=0
for i in range(len(c)):
  for j in range(i+1,len(c)):
    for k in range(j+1,len(c)):
      if (c[j]<c[i]and c[k]<c[i]and c[j]!=c[k]and c[i]<c[j]+c[k])or (c[i]<c[j]and c[k]<c[j]and c[i]!=c[k]and c[j]<c[i]+c[k])or (c[j]<c[k]and c[i]<c[k]and c[j]!=c[i]and c[k]<c[j]+c[i]):
        count+=1
print(count)

Solution (Python):
from itertools import combinations

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

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

is_counted = defaultdict(lambda: 0)
cnt = 0
for t in combinations(range(n), 3):
    t = [l[x] for x in t]
    if len(set(t)) != 3:
        continue
    if sum(t) - max(t) > max(t):
        cnt += 1
print(cnt)

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

Solution (Python):
N=int(input())
A=list(map(int, input().split()))
ans=0
for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      a,b,c = A[i],A[j],A[k]
      if len(set([a,b,c]))<=2:
        continue
      if abs(a-b)<c<a+b:
        ans += 1
print(ans)

Solution (Python):
import itertools

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

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


print(cnt)

Solution (Python):
import sys
import itertools

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    ans = 0
    for abc in itertools.combinations(L, r=3):
        if len(set(abc)) != 3:
            continue
        if sum(abc) - max(abc) > max(abc):
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

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

print(ans)

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

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

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




def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))



def main():
	n=II()
	A=LI()
	A.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 A[i]==A[j] or A[j]==A[k]:
					continue
				if A[i]+A[j]>A[k]:
					ans+=1

	print(ans)








if __name__ == "__main__":
	main()

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 len(set([l[i], l[j], l[k]])) == 3:
                if l[i] + l[j] > l[k]:
                    cnt += 1
print(cnt)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
count = 0
x = []
e = []
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]:
                    x.append([i+1,j+1,k+1])
                    e.append([l[i],l[j],l[k]])
count = 0           
for i in range(len(x)):
    e[i].sort()
    if e[i][0] + e[i][1] > e[i][2]:
        count +=1
print(count)

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

Solution (Python):
n = int(input())
a = (int(x) for x in input().split())

b = list(a)

cnt = 0

for i in range(len(b)) :
        for j in range(len(b)) :
                for k in range(len(b)):
                        c = [i,j,k]
                        if len(c) == len(set(c)) :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m and b[i] != b[j] and b[j] != b[k] and b[k] !=b[i]:
                                        cnt += 1
                                else :
                                        None
                        else :
                                None
                                
print(int(cnt/6))

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

Solution (Python):
import sys
from itertools import combinations


def main():
    ll = read_ll()
    result = c(ll)
    print(result)

def c(ll):
    count = 0
    for i, j, k in combinations(ll, 3):
        if i != j and j != k and i != k:
            if i + j > k:
                count += 1
    return count

def read_ll():
    n = int(input())

    ll = input().split()
    ll = list(map(int, ll))
    ll.sort()
    return ll

if __name__ == '__main__':
    main()

Solution (Python):
import math
import sys

def dict_sort(ans):
    ans=sorted(ans.items(),reverse=True,key=lambda kv:(kv[1]))

def is_prime(n):
    if n==1:
        return 0
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

def alphbates():
    return "abcdefghijklmnopqrstuvwxyz"

def binary_search(ls,n,flag):
    low=0
    hi=n-1
    while(low<=hi):
        mid=(low+hi)//2
        if ls[mid]==flag:
            return mid
        elif ls[mid]>flag:
            hi=mid-1
        else:
            low=mid+1
    return -1

def inp():
    ls=list(map(int,input().split()))
    return ls

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

n=int(input())
ls=inp()
if n<3:
    print(0)
    exit(0)
ls.sort()
ans=0
for i in range(n):
        for j in range(i+1,n):
                for k in range(j+1,n):
                        if ls[i]+ls[j]>ls[k] and ls[i]+ls[k]>ls[j] and ls[k]+ls[j]>ls[i] and ls[i]!=ls[j] and ls[j]!=ls[k] and ls[k]!=ls[i]:
                            ans+=1
print(ans)

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

print(cnt)

Solution (Python):
*l,=map(int,[*open(0)][1].split())
print(sum(i<j<k<i+j for i in l for j in l for k in l))

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans=0
if n<=2:
    print(0)
else:
    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]:
                    ans+=1

    print(ans)

Solution (Python):
n = int(input())
a = (int(x) for x in input().split())

b = list(a)

cnt = 0

for i in range(len(b)) :
        for j in range(len(b)) :
                for k in range(len(b)):
                        c = [i,j,k]
                        if len(c) == len(set(c)) :
                                d = [b[i],b[j],b[k]]
                                m = max(d) 
                                if m < sum(d) - m and b[i] != b[j] and b[j] != b[k] and b[k] !=b[i]:
                                        cnt += 1
                                else :
                                        None
                        else :
                                None
                                
print(int(cnt/6))

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

Solution (Python):
n=int(input())
l=list(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] and l[j]!=l[k] and l[k]!=l[i] and 2*max([l[i],l[j],l[k]])<sum([l[i],l[j],l[k]]):
				c+=1

print(c)

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

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

for pair in itertools.combinations(A, 3):
    if (pair[0]!=pair[1]) and (pair[1]!=pair[2]) and (pair[0]!=pair[2]):
        if (pair[0]+pair[1] > pair[2]) and (pair[1]+pair[2] > pair[0]) and (pair[0]+pair[2] > pair[1]):
            cnt += 1

print(cnt)