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



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    ll = rli()
    ans = 0
    for i in range(n):
        li = ll[i]
        for j in range(i+1, n):
            lj = ll[j]
            for k in range(j+1, n):
                lk = ll[k]
                l = [li, lj, lk]
                l.sort()
                if l[0] == l[1] or l[1] == l[2]:
                    continue
                if l[0]+l[1] > l[2]:
                    ans += 1
    print(ans)
        


if __name__ == '__main__':
    main()

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

Solution (Python):



import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
import itertools

input = sys.stdin.readline




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

ans = 0
for a in list(itertools.combinations(L, 3)):
    a1, a2, a3 = a
    if a1 == a2 or a2==a3 or a3 == a1:
        continue
    a = list(a)
    a.sort()
    if a[2] < a[0] + a[1]:
        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(N):
        for k in range(N):
            a,b,c=L[i],L[j],L[k]
            if i<j<k and a!=b and b!=c and c!=a:
                if a+b>c and b+c>a and c+a>b:
                    ans+=1
                    

print(ans)

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

Solution (Python):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    L = nl()
    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)


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

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
li = rl()
cnt = 0
for lis in list(itertools.combinations(li, 3)):
    a, b, c = sorted(lis)
    if a+b > c and a!=b!=c and c!=a:
        cnt += 1
print(cnt)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ls = list(mapint())
Ls.sort()
ans = 0
for i in range(N-2):
    a = Ls[i]
    for j in range(i+1, N-1):
        b = Ls[j]
        for k in range(j+1, N):
            c = Ls[k]
            if a==b or b==c or c==a:
                continue
            if a+b>c and a+c>b and b+c>a:
                ans += 1
print(ans)

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

Solution (Python):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    r = set()
    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]:
                    if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                        r.add((i,j,k))
    return len(r)
    
    

print(main())

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

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

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
li.sort()
c = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            if li[i] == li[j] or li[j] == li[k] or li[k] == li[i]:
                continue
            else:
                if li[i]+li[j] > li[k] and li[k]+li[j] > li[i] and li[i]+li[k] > li[j]:
                    c += 1
print(c//6)

Solution (Python):
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10
    N = II()
    L = LMIIS()
    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)


    
main()

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

cnt = 0

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

print(cnt)

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

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

def foo(i, j, k):
  if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
    return 0
  if L[i] + L[j] - L[k] > 0 and L[i] + L[k] - L[j] > 0 and L[j] + L[k] - L[i] > 0:
    return 1
  else:
    return 0

ans = 0
for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1,N):
      if foo(i, j, k):
        ans += 1
print(ans)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


n = onem()

a = l()
a.sort()
cou = 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] > a[k] and a[k] + a[j] > a[i] and a[i] + a[k] > a[j] and a[i] != a[j] and a[j] != a[k]:
                cou += 1
print(cou)

Solution (Python):

import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

from itertools import product,permutations as p, combinations as c

n = inp()

x = ip()
ct = 0
for i in c(x,3):
    
    a,b,c = list(sorted(i))
    if len(set(i)) == 3 and a+b > c:
        ct += 1
print(ct)

Solution (Python):
import sys

input = sys.stdin.readline


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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N = in_n()
    L = sorted(in_nl())

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

import collections as cl
import sys


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 main():
    N = II()
    target = LI()

    target.sort()

    ans = 0

    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if target[i] != target[j] != target[k]:
                    if target[k] < target[i] + target[j]:
                        ans += 1

    print(ans)


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

print(ans)

Solution (Python):




import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict


MOD = 10 ** 6 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def Main():
    n = read_int()
    l = read_int_list()
    cnt = 0

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

if __name__ ==  '__main__':
    Main()

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
l = na()
l.sort()
ans = 0

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

print(ans)

Solution (Python):

N = int(input())
L = list(map(int, input().split()))
ans = 0
for k in range(N-2):
  for j in range(k+1, N-1):
    for l in range(j+1, N):
      li = [L[k], L[j], L[l]]
      li.sort()
      if li[0] < li[1] < li[2]:
        if li[2] < li[0] + li[1]:
          ans += 1
print(ans)

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

c = 0

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

print(c)

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

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

Solution (Python):

import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    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] 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())
b = list(map(int,input().split()))
ret = 0
from itertools import combinations
for x,y,z in list(combinations(range(n),3)):
    x,y,z=b[x],b[y],b[z]
    if x == y or x == z or y == z:
        continue
    else:
        if x+y>z and y+z>x and z+x>y:
            ret += 1

print(ret)

Solution (Python):
N=int(input())
*L,=map(int,input().split())
i=0
ans=0
while i<N:
    j=i+1
    while j<N:
        k=j+1
        while k<N:
            a,b,c=sorted([L[i],L[j],L[k]])
            if c<a+b and len(set([a,b,c]))==3:
                ans+=1
            k+=1
        j+=1
    i+=1
print(ans)

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

arr.sort()
length = len(arr)

ans = 0
for x in range(length):
    for y in range(x + 1, length):
        for z in range(y + 1, length):
            if arr[x] != arr[y] and arr[y] != arr[z] and arr[z] != arr[x]:
                if arr[x] + arr[y] > arr[z]:
                    ans += 1

print(ans)

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            m = max(a[i], a[j], a[k])
            if len(set([a[i], a[j], a[k]])) == 3 and m < (a[i] + a[j] + a[k] - m):
                ans+= 1
print(ans)

Solution (Python):
import copy
import math
import time
import statistics
import math
import itertools
import bisect
from decimal import *


def get_int():
    return int(input())

def get_string():
    return input()

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

def get_string_list():
    return input().split()

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

def get_string_char_list():
    return list(str(input()))


'''
while (idx < n) and ():

    idx += 1
'''

def main():

    start = time.time()

    
    n = get_int()

    a = get_int_list()
    a.sort()

    ans = 0
    for i in range(n):
        for ii in range(i+1,n):
            if a[i] == a[ii]:
                continue
            for iii in range(ii+1,n):
                if a[ii] == a[iii]:
                    continue
                if a[i] + a[ii] > a[iii]:
                    ans += 1

    print(ans)



if __name__ == '__main__':
    main()

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

ret = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            x,y,z = l[i],l[j],l[k]
            lis = [x,y,z]
            lis = sorted(lis)
            if len(set(lis)) == 3 and lis[-1] < lis[0] + lis[1]:
                
                ret+=1

print(ret)

Solution (Python):
from itertools import combinations

n = int(input())
l = sorted(map(int, input().split()))
c = 0
for i, j, k in combinations(range(n), 3):
    li, lj, lk = l[i], l[j], l[k]
    if li == lj or lj == lk or lk == li:
        continue
    if li + lj > lk:
        c += 1
print(c)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
a=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            b=[l[i],l[j],l[k]]
            p,q,r=min(b),sum(b)-min(b)-max(b),max(b)
            a+=(len(set(b))==3)and (p+q>r)
print(a)

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

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")



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


if __name__ == '__main__':
    main()

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

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

n = int(input())
L = list(map(int,input().split()))
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:
        continue
      A = L[i] + L[j] + L[k]
      if 2*max([L[i] , L[j] , L[k]])<A:
        count += 1
        
print(count)

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

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

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

cnt = 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]:
                cnt += 1
print(cnt)

Solution (Python):
def main():
    N = int(input())
    *L, = sorted(map(int, input().split()))

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


if __name__ == '__main__':
    main()

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):
            a=l[i]
            b=l[j]
            c=l[k]
                
            if(a!=b and b!=c and c!=a)and (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 = sorted(map(int, input().split()))
ans = 0

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

print(ans)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
ans = 0
l.sort()
if n <= 2:
    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 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):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

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

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                continue
            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()))

ans = 0
for comb in combinations(L, 3):
    l1,l2,l3 = comb
    if l1 != l2 and l2 != l3 and l1 != l3:
        if sum(comb) - max(comb) > max(comb):
            ans += 1

print(ans)

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

Solution (Python):

import sys
import itertools as it

def solve(N: int, L: "List[int]"):
    a = 0
    L = sorted(L)
    for k in it.combinations(L,3):
        if (k[0] != k[1] != k[2]) and (k[0]+k[1]>k[2]):
            a+=1
    print(a)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    L = [int(next(tokens)) for _ in range(N)]  
    solve(N, L)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

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




if __name__ == '__main__':
    main()

Solution (Python):
from bisect import bisect_left, bisect_right
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):
        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]:
                ans += 1

print(ans)

Solution (Python):
from sys import stdin, setrecursionlimit

setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi, radians, sin, cos

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

N = int(input())

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





A.sort(reverse = True)


answer = 0
for i in range(N):
    ai = A[i]
    for j in range(i + 1, N):
        aj = A[j]
        for k in range(j + 1, N):
            ak = A[k]
            
            if ai < aj + ak and aj < ai + ak and ak < ai + aj and ai != aj and aj != ak and ak != ai:
                answer += 1

print(answer)

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


if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):
import itertools
def resolve():
    N = int(input())
    L = list(map(int,input().split()))
    count=0
    for i,j,k in itertools.combinations(L,3):
        if i+j > k and i+k > j and j+k > i and i!=j and j!=k and k!=i:
            count +=1 
    print(count)
resolve()

Solution (Python):

N = int(input())

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

ans = 0

for i in range(N):

    for j in range(i):

        for k in range(j):

            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue

            if max(L[i],L[j],L[k]) < (L[i]+L[j]+L[k]) - max(L[i],L[j],L[k]):
                ans += 1

print (ans)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
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[k] != L[i]:
                edges = [L[i],L[j],L[k]]
                edges.sort()
                if edges[0]+edges[1] > edges[2]:
                    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):
            A,B,C = L[i],L[j],L[k]
            if A != B and B != C and C != A and A+B+C - max(A,B,C) > max(A,B,C):
                ans += 1

print(ans)