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())
long_list = input().split()
count = 0
for i in range(N):
    long_i = int(long_list[i])
    for j in range(N-i-1):
        long_j = int(long_list[i+j+1])
        for k in range(N-i-j-2):
            long_k = int(long_list[i+j+k+2])
            if long_i == long_j or long_j == long_k or long_k == long_i:
                pass
            elif long_i + long_j > long_k and long_i + long_k > long_j and long_j + long_k > long_i:
                count += 1    
            else:
                pass

print("{0}".format(count))

Solution (Python):
from itertools import (
    accumulate,  
    groupby,  
    permutations,  
    combinations,  
    product,  
    combinations_with_replacement,  
)

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

def check(i, j, k):
    if i != j and j != k and k != i:
        maxi = max(i, j, k)
        total = i + j + k
        return maxi < total - maxi
    else:
        return 0


cnt = 0
for i, j, k in combinations(L, 3):
    cnt += check(i, j, k)

print(cnt)

Solution (Python):
n,*l=map(int,open(0).read().split())
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 or b==c or c==a:
        continue
      if abs(b-c)<a<b+c:
        cnt+=1
print(cnt)

Solution (Python):
from sys import exit, stdin




input = stdin.readline

(N,) = map(int, input().split())
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] or L[j] == L[k] or L[k] == L[i]:
                continue
            elif max([L[i], L[j], L[k]]) * 2 < sum([L[i], L[j], L[k]]):
                cnt += 1


print(cnt)

Solution (Python):
from math import *
import sys,bisect,copyreg,copy,statistics,os
def inp(): return sys.stdin.readline().strip()
def IIX(): return (int(x) for x in sys.stdin.readline().split())
def II(): return (int(inp()))
def LI(): return list(map(int, inp().split()))
def LS(): return list(map(str, inp().split()))
def L(x):return list(x)
def out(var): return sys.stdout.write(str(var))


n=II()
sizes=LI()
t=0
sizes.sort()

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

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

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

ans = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]:
                continue
            else:
                ver = [l[i],l[j],l[k]]
                ver.sort()
                if ver[0] + ver[1] > ver[2]:
                    ans += 1

print(ans)

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

nums = set([])
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            if l[i] == l[j] or l[i] == l[k] or l[j] == l[k]:
                continue
            else:
                ver = [l[i],l[j],l[k]]
                num = [i,j,k]
                ver.sort()
                num.sort()
                if ver[0] + ver[1] > ver[2]:
                    nums.add(tuple(num))

print(len(nums))

Solution (Python):
n = int(input())
l = sorted(map(int, input().split()))[::-1]

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
i = len(l)-1
j = len(l) -2
k = len(l) -3
ans = 0
while i >= 2:
  j = i-1
  while j >= 1:
    k = j -1
    while k >= 0:
      if l[i] > l[j] > l[k] and l[i] - l[k] < l[j]:
        ans += 1
      else:
        pass
      k -= 1
    j -= 1
  i -= 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(N-2-i):
    for k in range(N-2-i-j):
      J = 1 + i + j
      K = 2 + i + j + k
      L_list = [L[i], L[J], L[K]]
      L_list.sort()
      
      if L[i] == L[J] or L[J] == L[K] or L[K] == L[i]:
        pass
      else:
        if L_list[0] + L_list[1] > L_list[2]:
          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]) and (arr[i]!=arr[k]) and (arr[j]!=arr[k]):
                if (arr[i]+arr[j])>arr[k]:
                    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

main()

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

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

res = 0

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

print(res)

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

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

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

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


def calcu(N,L):

    if N <= 2:
        return 0

    res = 0
    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]
                if a == b or b == c or c == a:
                    pass
                elif a+b>c and b+c>a and c+a>b:
                    res += 1
    return res

print(calcu(N,L))

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

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
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]!=L[k]:
                sum_=L[i]+L[j]+L[k]
                if max(L[i],L[j],L[k])*2<sum_:
                    count+=1                

print(count)

Solution (Python):
N = int(input())
L = sorted(map(int,input().split()))
cnt = 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 a==c or b==c:
                continue
            if a+b > c:
                cnt += 1
print(cnt)

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

L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        
        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[k]<L[i]+L[j]:
                ans += 1
print(ans)

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())

x = list(map(int,input().split()))
x.sort()

con = 0

for p in range(n):
    for q in range(p+1,n):
        for r in range(q+1,n):
            if x[p] != x[q] and x[q] != x[r] and x[r] < (x[p] + x[q]):
                con += 1
                
print(con);

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 = []
L.append(input())

A = L[0].split()
B = [0] * N
for i in range(N):
	B[i] = int(A[i])


ans = 0

C = [0] *3
C2 = [0] *3

for i in range(N-2):
	C[0] = B[i]
	for j in range(N-1):
		C[1] = B[j]
		for k in range(N):
			C[2] = B[k]
			C2 = sorted(C)
			if i<j<k and  C2[2] < C2[1] + C2[0] and B[i] != B[j] and B[j] != B[k] and B[k] != B[i]:
				ans += 1


print(ans)

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

Solution (Python):
N = int(input())
L = [int(num) for num in input().split()]
L.sort()
a = 0
b = 0
c = 0
ans = 0
for i in range(N):
    if N < 3:
        break
    a = L[i]
    for j in range(i+1,N):
        b = L[j]
        for k in range(j+1,N):
            c = L[k]
            if a != b and a != b and b != c:
                if c-b < a and a < b+c:
                    ans = ans + 1

print(ans)

Solution (Python):
n,*l=map(int,open(0).read().split())
print(sum(i<j<k and i+j>k for i in l for j in l for k in l))

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(10000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

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):
            Li = [L[i], L[j], L[k]]
            if len(set(Li)) != 3:
                continue
            Li.sort()
            if Li[2] < Li[0] + Li[1]:
                cnt += 1

print(cnt)

Solution (Python):
def f(a,b,c):
    if a==b or b==c or c==a:
        return False
    if a+b>c and b+c>a and c+a>b:
        return True
    else:
        return False
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 f(a,b,c):
        ans+=1
print(ans)

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

for a in range(n-2):
    for b in range(a+1, n-1):
        if sortl[a] == sortl[b]:
            continue
        for c in range(b+1, n):
            if sortl[b] == sortl[c]:
                continue
            else:
                if sortl[a] + sortl[b] > sortl[c]:
                    count += 1

            

print(count)

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

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

            count+=1

    print(count)

Solution (Python):

from pdb import set_trace

import itertools

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


























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

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd


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

r=[i for i in range(n)]
if n<3:
    print(0)
    exit()
ans=0
for res in itertools.combinations(r,3):
    a,b,c=res
    if l[a]!=l[b] and l[b]!=l[c] and l[c]!=l[a]:
        la=l[a]
        lb=l[b]
        lc=l[c]
        if la<lb+lc and lb<la+lc and lc<la+lb:
            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):
            li = l[i]
            lj = l[j]
            lk = l[k]
            if li == lj or lj == lk or lk == li:
                continue
            else:
                s = max(li, lj, lk)
                if li+lj+lk > 2*s:
                    ans += 1
print(ans)

Solution (Python):
import sys
N = int(input())
L = [int(i) for i in input().split()]
L.sort()
if N <= 2:
    print(0)
    sys.exit()
ans = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if i < j and j < k and L[i] != L[j] and L[j] != L[k] and L[i] != L[k]:
                m = max(L[i], L[j], L[k])
                if m < L[i]+L[j]+L[k] - m:
                    ans += 1
print(ans)

Solution (Python):
n,*l=map(int,open(0).read().split())
l.sort()
print(sum(i<j<k and i+j>k for i in l for j in l for k in l))

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


ans = list(combinations(L,3))
ans1 = 0
for i in ans:
    if (i[0]+i[1]>i[2] and i[0]+i[2]>i[1] and i[1]+i[2]>i[0] and i[0]!=i[1] and i[0]!=i[2] and i[1]!=i[2]):
        ans1+=1

print(ans1)

Solution (Python):
def main():
    n=int(input())
    l=list(map(int,input().split()))
    ans=0
    for i in range(n):
        for k in range(i+1,n):
            for j in range(k+1,n):
                temp=[l[i],l[k],l[j]]
                if len(set(temp))==len(temp):
                    temp.sort()
                    if temp[0]+temp[1]>temp[2]:
                        ans+=1
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
ans=0
for a in l:
  for b in l:
    for c in l:
      if (a==b or b==c or a==c):
        continue
      if max([a,b,c])<a+b+c-max([a,b,c]):
        ans+=1
print(ans//6)

Solution (Python):
import sys
INF = 1 << 60
MOD = 10**9 + 7 
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    L = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        a = L[i]
        for j in range(i + 1, n):
            b = L[j]
            for k in range(j + 1, n):
                c = L[k]
                if len(set([a, b, c])) != 3:
                    continue
                if 2 * max(a, b, c) < sum([a, b, c]):
                    ans += 1
    print(ans)
resolve()

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

Solution (Python):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N = I()
L = LI()
L.sort()

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

print(ans)

Solution (Python):
import math
import itertools

N = int(input())

line = list(map(int, input().split(" ")))
line_set = set(line)
dic = {}

for num in line_set:
    cnt = line.count(num)
    dic[num] = cnt
    
pattern = list(itertools.combinations(line_set, 3))

sum_ = 0
for lis in pattern:
    a, b, c = lis
    if a + b > c and b + c > a and a + c > b:
        sum_ += dic[a]*dic[b]*dic[c]
print(sum_)

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

l = set(L)
di = {}
for c in l:
    di[c] = L.count(c)

cnt = 0
L = list(set(L))
L = sorted(L)


if N >= 3:
    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] > L[k]:
                    cnt += di[L[i]]*di[L[j]]*di[L[k]]
    print(cnt)

else:
    print(0)

Solution (Python):
import itertools

def has_duplicates(seq):
    return len(seq) != len(set(seq))


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

ans = 0

for kumi in itertools.combinations(l, 3):
    if has_duplicates(kumi):
        pass
    else:
        if kumi[0]+kumi[1] > kumi[2] and kumi[2] - kumi[0] < kumi[1]:
            ans +=1
    
print(ans)

Solution (Python):
import itertools
N = int(input())
L = [int(i) for i in input().split()]
count = 0
c = itertools.combinations([i for i in range(N)], 3)
for i, j, k in c:
  if not (L[i] == L[j] or L[j] == L[k] or L[k] == L[i]):
    a, b, c = sorted([L[i], L[j], L[k]])
    if a + b > c:
      count += 1
print(count)

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

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

total = 0

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

print(total)

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

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

L.sort()

ans = 0

for i, l1 in enumerate(L):
    for j, l2 in enumerate(L[i+1:]):
        if l1 == l2:
            continue
        for l3 in L[i+j+2:]:
            
            
            if l2 == l3:
                continue
            elif l3 - l2 < l1 < l3 + l2:
                ans += 1
print(ans)

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

l.sort()

ans = 0

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

print(ans)

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

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

for i in range(0, N-2):
    Li = L[i]
    for j in range(i+1,N-1):
        Lj = L[j]
        if Li == Lj:
            continue
        for k in range(j+1,N):
            Lk = L[k]
            if Li == Lk or Lj == Lk:
                continue
            Llist = [Li, Lj , Lk]
            Llist.sort()
            if Llist[0] + Llist[1] <= Llist[2]:
                continue
            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] or  L[j] ==  L[k] or L[k] == L[i]:
                continue
            
            if L[i] + L[j] > L[k]:
                count += 1

print(count)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
if n <= 2:
    print(0)
    exit()

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

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

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

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

Solution (Python):
n = int(input())
num_list = list(map(int, input().split()))
count = 0
b=0
c=0
a=0


for i in num_list:
  a = i
  for j in num_list:
    if j != a:
      b = j
      for k in num_list:
        if k != a and k != b : 
          c = k    
          if a + b > c and b + c > a and a + c > b :
            count = count + 1
        else:
          continue
    else:
      continue 
      
print(int(count/6))

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

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
r=[]
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] or l[i]==l[j] or l[j]==l[k] or l[i]==l[k]:
        continue
      a=l[i]+l[j]
      b=l[j]+l[k]
      c=l[i]+l[k]
      if a>l[k] and b>l[i] and c>l[j]:
        r.append([l[i],l[j],l[k]])
print(len(r))

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

Solution (Python):
n,*l=map(int,open(0).read().split())
print(sum(i!=j!=k!=i and j+k>i and k+i>j and i+j>k for i in l for j in l for k in l)//6)

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split()))
if N < 3:
    print(0)
    exit()
cnt = 0
Ns = [i for i in range(len(L))]
com = itertools.combinations(Ns, 3)

for ns in itertools.combinations(Ns, 3):
    
    if (L[ns[0]] != L[ns[1]] and L[ns[1]] != L[ns[2]] and L[ns[2]] != L[ns[0]]) and (L[ns[0]] + L[ns[1]] > L[ns[2]]) and (L[ns[1]] + L[ns[2]] > L[ns[0]]) and (L[ns[2]] + L[ns[0]] > L[ns[1]]):
        
        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(i+1, n):
        for k in range(j+1, n):
            if l[i] != l[j] and l[i] != l[k] and l[j] != l[k] and abs(l[i]-l[j]) < l[k] < l[i]+l[j]:
                count = 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):
            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)

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

print(cnt)

Solution (Python):
def findNumberOfTriangles(arr, n): 
      
    
    count = 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] and arr[j]!=arr[k] and arr[i]!=arr[k]):
                    
                
                
                    if (arr[i] + arr[j] > arr[k] and 
                        arr[i] + arr[k] > arr[j] and 
                        arr[k] + arr[j] > arr[i]): 
                            count += 1
    return count 
  


n=int(input())
arr = list(map(int,input().split()))
size = len(arr) 
  
print(findNumberOfTriangles(arr, size))

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

ans = 0

for i in range(len(Ls)- 2):
    first_side = Ls[i]

    for j in range(i + 1, len(Ls)):
        second_side = Ls[j]
        
        if first_side != second_side:
            
            ans = ans + len([i for i in Ls[j+1:] if i != first_side and i != second_side and first_side + second_side > i and first_side + i > second_side and second_side + i > first_side])

print(ans)

Solution (Python):
import collections
import statistics as st
N = int(input())
L = list(map(int,input().split()))
L.sort()
M = list(set(L))
M.sort()
C = collections.Counter(L)

ans = 0

for i in range(len(M)):
    for j in range(len(M)):
        for k in range(len(M)):
            if M[i] == M[j] or M[i] == M[k] or M[j] == M[k]:
                continue
            else:
                if M[i]<M[j]<M[k] and M[i]+M[j] > M[k] and M[i]+M[k] > M[j] and M[j]+M[k] > M[i]:
                    ans += list(C.values())[i]*list(C.values())[j]*list(C.values())[k]


print(ans)

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

ans = 0
if N < 3:
    ans = 0
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                    if S[i] + S[j] > S[k] and S[j] + S[k] > S[i] and S[k] + S[i] > S[j]:
                        ans += 1
print(ans)

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

FF= []

count =0
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]
            if a != b and b != c and a != c and a + b > c and b + c > a and c + a > b:
                    FF.append(str(a) + str(b) + str(c))
print(len(FF))

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

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

list1 = input().split()
list2 = []
for i in range(0,len(list1)):
    list2.append(int(list1[i]))
count = 0
if(n<=2):
    count = 0
for i in range(n):
    if(i+2==len(list2)):
        continue
    for j in range(i+1,n):
        if(i+1==len(list2)):
            continue
        for k in range(j+1,n):
            if(list2[i] != list2[j] and list2[i] != list2[k] and list2[j] != list2[k]):
                ma = max(list2[i],list2[j],list2[k])
                mi = min(list2[i],list2[j],list2[k])
                tyuukann = list2[i]+list2[j]+list2[k]-ma-mi
                if(ma<mi+tyuukann):
                    count = count + 1

print(count)

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

for j, b in enumerate(L_list):
    if b == 1:
        continue
    for k, c in enumerate(L_list):
        if c == 1 or c == b:
            continue
        elif (a+b) > c and (b+c) > a and (c+a) > b and a < b < c:
            count += 1


for i, a in enumerate(L_list):
    if a == 1:
        continue
    for j, b in enumerate(L_list):
        if b == 1 or b == a:
            continue
        for k, c in enumerate(L_list):
            if c == 1 or c == b or c == a:
                continue
            elif (a+b) > c and (b+c) > a and (c+a) > b and a < b < c:
                count += 1

print(count)