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
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()

n = readInt()
arr = readIntList()
if len(arr) < 3:
    print("0")
    exit()
arr.sort()
count = 0
for i in range(n):
    for j in range(i+1,n):
        if arr[i] == arr[j]:
            continue
        for k in range(j+1,n):
            if arr[i] == arr[k] or arr[j] == arr[k]:
                continue
            if arr[i] + arr[j] > arr[k]:
                count += 1
print(count)

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

print(ans)

Solution (Python):
import itertools
N = int(input())
l = map(int,input().split())

cnt = 0
for a,b,c in itertools.combinations(l,3):
    if abs(a-b) < c < a+b and a != b and b != c and a != c:
        cnt += 1

print(cnt)

Solution (Python):
import itertools
N = int(input())
l = map(int,input().split())

cnt = 0
for a,b,c in itertools.combinations(l,3):
    if abs(a-b) < c < a+b and len(set([a,b,c])) == 3:
        cnt += 1

print(cnt)

Solution (Python):
import itertools

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

c = list(itertools.combinations(l, 3))
ans = 0
for i in c:
    j = sorted(i)
    if j[0] != j[1] != j[2] != j[0]:
        if j[2] < j[0]+j[1]:
            ans += 1
print(ans)

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

an = input().split()

for i in range(len(an)):
    an[i] = int(an[i])

ln = sorted(an)

ans = 0

for i in range(k):
    for j in range(i,k):    
        for l in range(j,k):
            a1 = int(ln[i])
            a2 = int(ln[j])
            a3 = int(ln[l])
            if a1!=a2 and a2 != a3:
                m = a1 + a2
                if a3 < m:
                    ans += 1

print(ans)

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

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(len(L)):
    a=L[i]
    for j in range(i+1,len(L)):
        if L[j]!=a:
            b=L[j]
            for k in range(j+1,len(L)):
                if L[k]!=b:
                    if a+b>L[k]:
                        ans+=1
                    else:
                        break
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 i < j < k:
                if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                    continue
                if L[i] + L[j] + L[k] <= max(L[i], L[j], L[k]) * 2:
                    continue
                ans += 1

print(ans)

Solution (Python):
n,*l=map(int,open(0).read().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);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] > l[k] and l[i] != l[j] and l[j] != l[k]:
        ans += 1
print(ans)

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

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

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

if n <= 2:
    print(0)
else:

    for i in range(0,n-2):
        for h in range(i+1,n-1):
            for j in range(h+1,n):
                if (abs(p[i]-p[h]) < p[j] < p[i]+p[h]) and (p[i] != p[h] and p[h] != p[j] and p[j] != p[i]):

                    count += 1

    print(count)

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

ans = 0
if N<=2:
  print(0)
  exit()
for i1 in range(N-2):
  l1 = L[i1]
  for i2 in range(i1+1,N-1):
    l2 = L[i2]
    for i3 in range(i2+1,N):
      l3 = L[i3]
      if l1==l2 or l2==l3 or l3==l1: continue
      tmp = sorted([l1,l2,l3])
      if tmp[0]+tmp[1]>tmp[2]:
        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):
      if A[i] != A[j] and A[j] != A[k] and A[k] != A[i] and (A[i] + A[j]>A[k]) and (A[j] + A[k]>A[i]) and (A[k] + A[i]>A[j]):
        count = count + 1

print(count)

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

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

Solution (Python):
from itertools import combinations

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

ans = 0

for a,b,c in combinations(L, 3):
    ans += a < b < c < a+b

print(ans)

Solution (Python):
import itertools

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

L.sort(reverse = True)
li = list(itertools.combinations(L, 3))

ans = 0
for v in li:
    if v[0] != v[1] and v[1] != v[2] and v[0] - v[1] < v[2]:
        ans += 1
print(ans)

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

print(ans)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
res = 0
for ii, i in enumerate(arr):
    for jj, j in enumerate(arr):
        for kk, k in enumerate(arr):
            if ii < jj < kk and i != j and j != k and k != i:
                if i + j > k and j + k > i and k + i > j:
                    res += 1
print(res)

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

N_tri=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]:
        L_sorted=sorted([L[i],L[j],L[k]])
        if L_sorted[0]+L_sorted[1]>L_sorted[2]:
          N_tri+=1

print(N_tri)

Solution (Python):
def triangle(N, Ls):
  result = 0
  res = []
  numbers = {}
  edgeLength = list(set(Ls))
  for i in edgeLength:
    numbers[i] = Ls.count(i)
  for i in range(len(edgeLength)):
    a = edgeLength[i]   
    copy1 = edgeLength[i+1:]
    for j in range(len(copy1)):
      b = copy1[j]
      copy2 = copy1[j+1:]
      for k in range(len(copy2)):
        c = copy2[k]
        if a + b > c and b + c > a and c + a > b:
          res.append([a, b, c])
  for val in res:
    result += numbers[val[0]] * numbers[val[1]] * numbers[val[2]]
  return result




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

Solution (Python):
def ifTriangle(v):
    largest = max(v)
    smallers_sum = 0
    for x in v:
        if not x == largest:
            smallers_sum += x
    if smallers_sum > largest:
        return True
    return False


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

count = 0
before_i = -1
before_j = -1
before_k = -1
for i in range(N-2):
    for j in range(i+1, N-1):
        if L[j] == L[i]:
            continue
        if L[i]/2 >= L[j]:
            break
        for k in range(j+1, N):
            if L[k] == L[j]:
                continue
            if ifTriangle([L[i], L[j], L[k]]):
                count += 1
print(count)

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


for i in range(N-2):
    for j in range(N-i-1):
        for k in range(N-i-j-2):
            if L[i]<L[i+j+1]<L[i+j+k+2]and L[i]+L[i+j+1]>L[i+j+k+2]:
                K=K+1
print(K)

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
 
l.sort()
 
def func(one,two,three):
  if len({one,two,three})==3 and one+two>three:
    return True
  return False
 
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three=l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)

Solution (Python):
n = int(input())
L = sorted(list(map(int,input().split())),reverse = True)
ans = 0
for i in L:
    for j in L:
        for k in L:
            if i<j<k:
                if i + j>k:
                    ans += 1
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
count = 0
for item in itertools.combinations(l, 3):
    if len(set(item)) == 3:
        if item[0] + item[1] > item[2] and item[1] + item[2] > item[0] and item[2] + item[0] > item[1]:
            count += 1
print(count)

Solution (Python):
import copy
from sys import stdin


N = int(stdin.readline().rstrip())

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

count = 0

for i in range(N):
    A = L.pop()
    Ln = copy.copy(L)
    for j in range(len(Ln)):
          B = Ln.pop()
          Lm = copy.copy(Ln)
          for k in Lm:
              C = k
              if ( A != B ) and ( B != C ) and ( C != A ) and ( A + B > C ) and ( B + C > A ) and ( C + A > B ):
                    count+=1
              
          

print(count)

Solution (Python):
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in L:
    for j in L:
        for k in L:
            if i < j < k:
                if i + j + k > max(i,j,k) * 2:
                    ans += 1
else:
    print(ans)

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

l.sort()
ans = 0

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

print(ans)

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

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

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            B = [A[i], A[j], A[k]]
            if len(set(B)) == 3 and (max(B) < sum(B) - max(B)):
                total += 1

print(total)

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

cnt = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if i != j and j != k and k != i and l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                nagasa = sorted([l[i],l[j],l[k]])
                if nagasa[0] + nagasa[1] > nagasa[2]:
                    cnt += 1
print(cnt // 6)

Solution (Python):
from itertools import*
n=input()
l = map(int,input().split())
ans = 0
for a, b, c in combinations(l, 3):
    if a != b != c != a and a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

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

ans = 0

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

print(ans)

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

cnt = 0
l.sort()

for i in range(0, n-2):
    for j in range(i+1, n-1):
        if l[i] == l[j]:
            continue
        for k in range(j+1, n):
            if l[j] == l[k]:
                continue
            if l[k] < l[i] + l[j]:
                cnt += 1

print(cnt)

Solution (Python):

import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


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


def main():
    N = INT()
    L = LI()
    L.sort()
    counter = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[j] == L[k]:
                    continue
                if L[i]+L[j] > L[k]:
                    counter += 1
                    
    print(counter)
    return


if __name__ == '__main__':
    main()

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

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

Solution (Python):


def main():

    
    cnt = 0

    
    n = int(input())
    l_list = list(map(int, input().split()))
    l_list.sort()

    
    for i in range(0, n - 2):
        for j in range(i + 1, n -1):
            for k in range(j + 1, n):
                if (not((l_list[i] != l_list[j]) and (l_list[i] != l_list[k]) and (l_list[j] != l_list[k]))):
                    continue
                if (not((l_list[i] < l_list[j] + l_list[k]) and (l_list[j] < l_list[i] + l_list[k]) and (l_list[k] < l_list[i] + l_list[j]))):
                    continue
                cnt += 1
    
    print(cnt)


if __name__ == '__main__':
    main()

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

row=sorted(map(int,input().split()))

cnt=0

for i in range(len(row)):
  for j in range(i+1,len(row)):
    for k in range(j+1,len(row)):
      if row[i]!=row[j] and row[j]!=row[k] and row[i]!=row[k]:
        if (abs(row[j]-row[i]) < row[k]) and (row[k] < row[j]+row[i]):
          cnt+=1

print(cnt)

Solution (Python):
from collections import defaultdict
import itertools

N = int(input())

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

dic = defaultdict(int)

for num in L:
    dic[num] += 1

set_L = set(L)

comb = list(itertools.combinations(set_L, 3))

ans = 0
for a,b,c in comb:
    if a+b <= c or b+c<=a or c+a <= b: continue
    ans += dic[a] * dic[b] * dic[c]

print(ans)

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

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

count = 0

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

            if l[i] + l[j] > l[k]:
                count += 1

print(count)

Solution (Python):
n = int(input())
ls = sorted(list(map(int, input().split())))
cnt = 0
for i in range(len(ls) - 2):
    a = ls[i]
    for j in range(i+1, len(ls) - 1):
        b = ls[j]
        for k in range(j+1, len(ls)):
            c = ls[k]
            if a==b or a==c or b==c:
                continue
            if a+b > c and b+c > a and c+a > b:
                cnt += 1
print(cnt)

Solution (Python):

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

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


print(c)

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

count = 0
i = 0
while i < N:
    a = L_list[i]
    j = 0
    while j < i:
        b = L_list[j]
        k = 0
        while k < j:
            c = L_list[k]
            k += 1
            if a == b or b == c or c == a:
                continue
            if a + b > c and b + c > a and c + a > b:
                count += 1
        j += 1
    i += 1
                
print(count)

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):
            x = max(L[i], L[j], L[k])
            y = L[i] + L[j] + L[k]
            if x < y - x and (L[i] != L[j] and L[i] != L[k] and L[j] != L[k]):
                count += 1

print(count)

Solution (Python):
import itertools

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

c = list(itertools.combinations(l, 3))
ans = 0
for i in c:
    j = sorted(i)
    if j[0] != j[1] != j[2] != j[0]:
        if j[2] < j[0]+j[1]:
            ans += 1
print(ans)

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

Solution (Python):
a = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

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

Solution (Python):
N=int(input())
L=list(map(int, input().split()))
count=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                if max(L[i],L[j],L[k])<L[i]+L[j]+L[k]-max(L[i],L[j],L[k]):
                    count += 1
                else:
                    pass

print(count)

Solution (Python):
import itertools

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

Acomb = list(itertools.combinations(A, 3))

ans = 0
for tri in Acomb: 
  if tri[0] < tri[1] and tri[1] < tri[2] and tri[0] + tri[1] > tri[2]:
    ans += 1
print(ans)

Solution (Python):
def solve(string):
    _, *l = map(int, string.split())
    l.sort()
    ans = 0
    for i, l0 in enumerate(l[:-2]):
        for j, l1 in enumerate(l[i + 1:-1]):
            if l0 == l1:
                continue
            for l2 in l[i + j + 2:]:
                if l1 == l2:
                    continue
                if l2 < l0 + l1:
                    ans += 1
                else:
                    break
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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

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


for i in range(0, length-2):
    for j in range(i+1, length-1):
        if L_sort[i] == L_sort[j]:
            continue
        for k in range(j+1, length):
            if L_sort[j] == L_sort[k]:
                continue
            if L_sort[i] + L_sort[j] > L_sort[k]:
                count += 1
print(count)

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
T = 0
if N > 2:
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                a = L[i]
                b = L[j]
                c = L[k]
                abc = sorted(list({a, b, c}))
                if len(abc) == 3 and abc[0] + abc[1] > abc[2]:
                    T += 1
print(T)

Solution (Python):
def solve(n, arr):
    
    arr.sort()

    ans = 0

    for (i, _) in enumerate(arr):
        for j in range(i + 1, len(arr)):
            for k in range(j + 1, len(arr)):
                if arr[i] != arr[j] and arr[i] != arr[k] and arr[j] != arr[k]:
                    if arr[i] + arr[j] > arr[k]:
                        ans += 1
    return ans


if __name__ == "__main__":
    n = int(input())
    arr = list(map(int, input().split(' ')))
    print(solve(n, arr))

Solution (Python):

N = int(input())
L = list(map(int,input().split()))
d = {i:L.count(i) for i in L}

L = sorted(L)
ans = 0
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            cnt += 1
            if L[k] < L[i] + L[j] and L[k] != L[i] and L[i] != L[j] and L[j] != L[k]:
                ans += 1
print(ans)

Solution (Python):

N = int(input())
L = list(map(int,input().split()))
d = {i:L.count(i) for i in L}

L = sorted(list(set(L)))
num = len(L)
ans = 0

for i in range(num-2):
    for j in range(i+1,num-1):
        for k in range(j+1,num):
            if L[k] < L[i] + L[j]:
                ans += d[L[k]]*d[L[i]]*d[L[j]]
            else:
                break
print(ans)

Solution (Python):















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

l.sort(reverse = True)

ctr = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if l[i] == l[j]:
            continue
        for k in range(j+1, n):
            if l[j] == l[k]:
                continue
            if l[i] < l[j] + l[k]:
                ctr += 1

print(ctr)

Solution (Python):
N = int(input())
bar = list(map(int, input().split()))
triangles = []
for i in range(N-2):
    for j in range(i + 1, N - 1):
        if bar[i] == bar[j]:
            continue
        for k in range(j + 1, N):
            if bar[j] == bar[k] or bar[i] == bar[k]:
                continue
            if (bar[i] + bar[j] > bar[k]) and (bar[j] + bar[k] > bar[i]) and (bar[i] + bar[k] > bar[j]):
                triangles.append([bar[i], bar[j], bar[k]])
print(len(triangles))

Solution (Python):
N = int(input())
bar = list(map(int, input().split()))
triangles = []
for i in range(N-2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if (bar[i] + bar[j] > bar[k]) and (bar[j] + bar[k] > bar[i]) and (bar[i] + bar[k] > bar[j]) and (len(set([bar[i], bar[j], bar[k]])) == 3):
                triangles.append([bar[i], bar[j], bar[k]])
print(len(triangles))

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

for i in range(N-2):
  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]:
        cnt += 1
        
print(cnt)

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

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

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

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

l = sorted(l)

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

print(ans)

Solution (Python):
import itertools

input()
rods = list(map(int, input().split(" ")))
sorted_rods = sorted(rods)

count = 0
for combination in itertools.combinations(sorted_rods, 3):
  a, b, c = combination
  if a != b and b != c:
    if a + b > c:
      count += 1
      
print(count)

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

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

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

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

ans = 0

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

print(ans)

Solution (Python):
def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop()

def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result))

if __name__ == "__main__":
    solve()

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

n =0

for i in range(N-2):
  for j in range(N-1):
    for k in range(N):
      if i<j and j<k and Llist[i]!=Llist[j] and Llist[j]!=Llist[k] and Llist[i]!=Llist[k] and Llist[i]+Llist[j]>Llist[k] and Llist[j]+Llist[k]>Llist[i] and Llist[i]+Llist[k]>Llist[j]:
        
        
        n+=1
print(n)

Solution (Python):
from itertools import combinations

n = int(input())
len_list = list(map(int, input().split()))
len_list = sorted(len_list)


per_len = list(combinations(len_list, 3))

count = 0

for i in range(len(per_len)):
    if per_len[i][2] == per_len[i][0] or per_len[i][1] == per_len[i][2] or per_len[i][0] == per_len[i][1]:
        pass
    
    else:
        if per_len[i][2] < per_len[i][0] + per_len[i][1] :
            count += 1
            
            

print(count)

Solution (Python):
from itertools import combinations
n = int(input())
l = list(map(int, input().split()))
comb = list(combinations(range(n), 3))
ans = 0
for i,j,k in comb:
    a = l[i]
    b = l[j]
    c = l[k]

    if a == b:
        continue
    if b == c:
        continue
    if c == a:
        continue
    if sum([a,b,c]) <= 2 * max(a,b,c):
        continue
    ans += 1
print(ans)

Solution (Python):
tmp = input()
line = input().split(" ")
for i in range(len(line)):
  line[i] = int(line[i])
line.sort()
count = 0
for i in range(0, len(line) - 2):
  for j in range(1, len(line) - 1):
    if i > j or i == j:
      continue
    for k in range(2, len(line)):
      if j > k or j == k:
        continue
      if int(line[i]) != int(line[j]) and int(line[j]) != int(line[k]):
        if int(line[i]) + int(line[j]) > int(line[k]):
          count += 1
print(count)

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

def is_unique(a, b, c):
    return (a != b) and (a != c) and (b != c)

def is_triangle(a, b, c):
    return (a + b > c) and (b + c > a) and (c + a > b)

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 is_unique(a, b, c) and is_triangle(a, b, c):
                cnt += 1
print(cnt)

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

count = 0


for i in range(0, n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            if list_l[i] != list_l[j] != list_l[k] and list_l[i] != list_l[k]:
                if list_l[i] < list_l[j] + list_l[k] and list_l[j] < list_l[i] + list_l[k] and list_l[k] < list_l[i] + list_l[j]:
                    
                    count += 1
print(count)

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

l.sort(reverse=True)
num = 0
for i in range(len(l) - 2):
	for j in range(i + 1, len(l) - 1):
		if l[i] == l[j]:
			continue

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

			if l[i] < (l[j] + l[k]):
				num += 1

print(num)