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):
import sys
input = lambda:sys.stdin.readline().strip()
n = int(input())
l = list(map(int,input().split()))
ans = 0
for l1 in range(n):
    for l2 in range(l1+1,n):
        for l3 in range(l2+1,n):
            if l[l1]!=l[l2] and l[l2]!=l[l3] and l[l1]!=l[l3]:
                if l[l1]+l[l2]>l[l3] and l[l2]+l[l3]>l[l1] and l[l1]+l[l3]>l[l2]:
                    
                    ans+=1
print(ans)

Solution (Python):
N = int(input())
L = [int(hoge) for hoge in input().split()]
ans = 0
for k in range(2,N):
    K = L[k]
    for j in range(1,k):
        J = L[j]
        for i in range(j):
            I = L[i]
            M = max(max(I,J),K)
            if I+J+K-M > M and I!=J and J!=K and K!=I:
                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 abs(L[j]-L[k])<L[i] and L[i]<L[j]+L[k] and L[i]!=L[j] and L[i]!=L[k] and L[k]!=L[j]:
        ans+=1
        
print(ans)

Solution (Python):



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


n = int(input())
l = lmp()
l.sort()
from collections import Counter
lc = list(Counter(l).items())
if len(lc) <= 2:
    print(0)
    exit()
cnt = 0
for i in range(len(lc)-2):
    for j in range(i+1,len(lc)-1):
        for k in range(j+1,len(lc)):
            if lc[i][0] + lc[j][0] > lc[k][0]:
                cnt += lc[i][1] * lc[j][1] * lc[k][1]
print(cnt)

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


def read():
    N = int(input().strip())
    L = list(map(int, input().strip().split()))
    return N, L


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


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

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(set([l[i],l[j],l[k]]))==3:
                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):
import itertools
N = int(input())
elist = list(map(int, input().split()))

result = 0
if len(elist) > 2:
    for comb in itertools.combinations(elist, 3):
        x, y, z = comb
        if x == y or y == z or z == x:
            continue
        m = max(x, y, z)
        if m < x+y+z - m:
            result += 1

print(result)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    L = LI()

    ans = 0
    for i, j, k in itertools.combinations(L, 3):
        if i != j and j != k and k != i:
            if i + j > k and j + k > i and k + i > j:
                ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()

Solution (Python):
import itertools

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

    if len(L) < 3:
        print(0)
        exit()

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

if __name__ == "__main__":
    main()

Solution (Python):

N = int(input())
Ls = [int(i) for i in input().split()]


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

print(count)

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

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

print(ans)

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

	print(ans)

 
if __name__ == "__main__":
  	main()

Solution (Python):

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

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

print(count)

Solution (Python):


N = int(input())

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

s=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] and L[i]<L[j]+L[k] and L[j]<L[i]+L[k] and L[k]<L[j]+L[i]:
                s+=1

print(s)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
ans=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            pro=[0,0,0]
            pro[0]=lis[i]
            pro[1]=lis[j]
            pro[2]=lis[k]
            if pro[0]==pro[1] or pro[0]==pro[2] or pro[1]==pro[2]:
                continue
            pro.sort()
            if pro[0]+pro[1]>pro[2]:
                ans+=1
print(ans)

Solution (Python):
def resolve():
    '''
    code here
    '''
    N = int(input())
    Ls = [int(item) for item in input().split()]
    Ls.sort()
    res = 0
    if N >= 3:
        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[j] and Ls[j] != Ls[k] and Ls[k] != Ls[i] :
                        res += 1
    print(res)

if __name__ == "__main__":
    resolve()

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):
      x, y, z = sorted([l[i], l[j], l[k]])
      if x + y > z and x != y and y != z:
        ans += 1
print(ans)

Solution (Python):
import itertools


def main():
    num = int(input())
    array = [int(x) for x in input().split()]
    array.sort()
    ans = 0
    for ls in itertools.combinations(array, 3):
        if ls[0] != ls[1] and ls[1] != ls[2]:
            if ls[0] + ls[1] > ls[2]:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
L.sort()
d={}
for l in L:
    if l in d:
        d[l]+=1
    else:
        d[l]=1

ans=0
for a in d:
    for b in d:
        for c in d:
            if a<b<c and a+b>c:
                ans+=d[a]*d[b]*d[c]
print(ans)

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

Solution (Python):
from itertools import combinations

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

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

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] or 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[i] + L[k] > L[j]:
                cnt += 1

print(cnt)

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

for i in range(n):
  for j in range(n):
    if i==j:
      break
    for k in range(n):
      if i==k or j==k:
        break
      
      if l[i]+l[j] > l[k] and l[j]+l[k] > l[i] and l[k]+l[i] > l[j]:
        if l[i]!=l[j] and l[j]!=l[k] and l[i]!=l[k]:
          count+=1
print(count)

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

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

print(count)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
flag=False
if n>=3:
  flag=True
if flag:  
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(i+2,n):
        if l[i]<l[j]<l[k] and (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 v in combinations(L, 3):
    v = sorted(v)
    if v[0] == v[1] or v[1] == v[2]:
        continue

    if v[0] >= v[1] + v[2] or v[2] >= v[1] + v[0]:
        continue

    ans += 1

print(ans)

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n = ni()
L = lma()
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[k] +L[j]>L[i] and L[i] +L[k]>L[j] :
                cnt+=1
print(cnt)

Solution (Python):
n=int(input())
l =list(map(int,input().split()))
l.sort()
ans=0
for p in range(0,n-2):
    for q in range(p,n-1):
        if l[p]==l[q]:
            continue
        for r in range(q,n):
            if l[q]==l[r]:
                continue
            if l[p]+l[q]>l[r]:
                ans+=1
            else:
                break
print(ans)

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

ans = 0
for lst in combinations(L, 3):
    if len(set(lst)) == 3 and max(lst) < sum(lst)-max(lst):
        ans += 1
print(ans)

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

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

Solution (Python):
def Istraiangle(A,B,C):
    if (A==B)|(B==C)|(A==C):
        return False
    if A+B>C:
        if A+C>B:
            if B+C>A:
                return True
    return False
count=0
N=int(input())
L=list(map(int,input().split()))
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if Istraiangle(L[i],L[j],L[k]):
                count+=1
print(count)

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

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

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

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if abs(L[i]-L[j]) < L[k] and L[k] < L[i]+L[j]:
                cnt += 1
print(cnt)

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

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

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


import itertools
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 len(set([a,b,c]))==3:
                if a+b>c and b+c>a and a+c > b:
                    ans+=1
print(ans)

Solution (Python):
from collections import defaultdict,deque
import math
def main():
    n = int(input())
    res = 0
    a=[int(i) for i in input().split()]
    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):
                if(a[i]!=a[j] and a[i]!=a[k] and a[j]!=a[k] and (a[i]+a[j] > a[k] and a[j]+a[k]>a[i] and a[i]+a[k]>a[j])):
                    res+=1
    print(res)
if __name__ == '__main__':
    main()

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

cnt = 0
for i in range( n ):
    li = l[ i ]
    for j in range( i + 1, n ):
        lj = l[ j ]
        for k in range( j + 1, n ):
            lk = l[ k ]
            if ( li - lj ) * ( lj - lk ) * ( lk - li ) == 0:
                continue
            if li + lj > lk and lj + lk > li and lk + li > lj:
                cnt += 1

print( cnt )

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math
from collections import deque
import itertools
import heapq

from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint




def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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


if __name__ == "__main__":

    main()

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

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

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

Solution (Python):
n = int(input())
a = 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):
            b=[a[i], a[j], a[k]]
            b.sort()
            if b[0]+b[1]>b[2]:
                if b[0]<b[1] and b[1]<b[2]:
                    count+=1
print(count)

Solution (Python):
import sys
import math
import collections
import bisect
import itertools



sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))




def main():
    n = ni()
    l = na()

    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                f1 = l[i] + l[j] > l[k]
                f2 = l[j] + l[k] > l[i]
                f3 = l[k] + l[i] > l[j]
                f4 = l[i] != l[j] and l[j] != l[k] and l[k] != l[i]
                if f1 and f2 and f3 and f4:
                    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):
    for j in range(i+1,n):
        for k in range(j+1,n):
            len = l[i] + l[j] + l[k]
            ma = max(l[i],l[j],l[k])
            rest = len - ma
            if ma < rest 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):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if not l[i] == l[j] and not l[j] == l[k] and not 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):
from itertools import *
N = int(input())
L = list(map(int,input().split()))
ans = 0

for C in combinations(L,3):
  C = sorted(C)
  if len(set(C))==3 and C[2]<C[0]+C[1]:
    ans+=1

print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

n=II()
ll=LI()
ll.sort()
ans=0

for i in range(n):
    for j in range(i):
        if ll[i]==ll[j]:continue
        for k in range(j):
            if ll[i]==ll[k] or ll[j]==ll[k]:continue
            if ll[i]<ll[j]+ll[k]:
                
                ans+=1
print(ans)

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

Solution (Python):
import sys
import bisect

t=1
for _ in range(t):
    
    
    
    n=int(input())
    l=list(map(int,input().split()))
    d={}
    for i in l:
        d[i]=d.get(i,0)+1
    l=list(set(l))
    l.sort()
    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[k]<l[i]+l[j]:
                    ans+=d[l[i]]*d[l[j]]*d[l[k]]
    print(ans)

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

if n <= 2:
  print(0)
  exit()
  
ans = 0

for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      a = lst[i]
      b = lst[j]
      c = lst[k]
      A = max(a, max(b, c))
      if a!=b and b!=c and c!=a:
        if 2*A < a+b+c:
          ans += 1
               
print(ans)

Solution (Python):
n = int(input())
L = sorted(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 i == j or j == k or k == i: continue
            a, b, c = L[i], L[j], L[k]
            if c < a + b and a != b != c:
                cnt += 1
print(cnt)

Solution (Python):
import sys
from bisect import bisect_left
def input(): return sys.stdin.readline().strip()

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, b, c = L[i], L[j], 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)



if __name__ == "__main__":
    main()

Solution (Python):

import sys

sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


sys.setrecursionlimit(10**7)








INF = 1 << 50


def run():
    N, *L = map(int, read().split())
    ans = 0
    for i in range(N-2):
        x = L[i]
        for j in range(i+1, N-1):
            y = L[j]
            for k in range(j+1, N):
                z = L[k]
                if x != y and y != z and z != x and z < x+y and x < y+z and y < x+z:
                    ans += 1


    print(ans)

if __name__ == "__main__":
    run()

Solution (Python):
import itertools
n=int(input())
l=map(int,input().split())
count=0
for a,b,c in itertools.combinations(l,3):
    if a!=b and b!=c and a!=c:
        if abs(b-c)<a and a<b+c:
            count+=1
print(count)

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




'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

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

print(ans)

Solution (Python):
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
L = rl()

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

Solution (Python):

import os
import sys
from io import BytesIO, IOBase




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


class union_find:
    def __init__(self, n):
        self.n = n
        self.rank = [0]*n
        self.parent = [int(j) for j in range(n)]
    
    def union(self,i,j):
        i = self.find(i)
        j = self.find(j)
        if self.rank[i] == self.rank[j]:
            self.parent[i] = j
            self.rank[j] += 1

        elif self.rank[i] > self.rank[j]:
            self.parent[j] = i
        else:
            self.parent[i] = j

    def find(self, i):
        temp = i
        if self.parent[temp] != temp:
            self.parent[temp] = self.find(self.parent[temp])
        return self.parent[temp]
from math import log2, ceil
from collections import deque, Counter as CC, defaultdict as dd
MOD = int(1e9+7)
def main():

    
        
        n = int(input())
        l = [int(j) for j in input().split()]
        ans =0 
        l.sort()
        for i in range(n):
            for j in range(i+1, n):
                for k in range(j+1, n):
                    s = [l[i], l[j], l[k]]
                    s.sort()
                    if((s.count(l[i])>1) or (s.count(l[j])>1) or (s.count(l[k])>1)):
                        continue
                    if(s[0]+s[1]>s[2]):
                        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):
    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=list((L[i],L[j],L[k]))
                if 2*max(A)<sum(A):
                    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):
      x, y, z = l[i], l[j], l[k]
      if x != y and y != z and z != x and x + y > z and x + z > y and y + z > x:
        ans += 1

print(ans)