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

Solution (Python):



N = int(input())
L_list = list(map(int, input().split()))
result = 0
setL = list(set(L_list))

countL = []  
def num_count(dum):
   return L_list.count(dum)
countL = list(map(num_count,setL))



for i in range(len(setL)):
    a=setL[i]
    for j in range(i+1,len(setL)):
        b=setL[j]
        for k in range(j+1,len(setL)):
            
            c=setL[k]
            if(a+b > c and b+c > a and c+a > b):
                
                
                result += countL[i]*countL[j]*countL[k]
print(result)

Solution (Python):


n=int(input())

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


cnt = 0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            q = [l[i],l[j],l[k]]
            q.sort()
            if (len(q) == len(set(q))) and (q[0] + q[1] > q[2]):
                cnt += 1
print(cnt)

Solution (Python):
    

def main():
    n = int(input())
    v = list(map(int, input().split()))

    counter = 0
    for ia in range(len(v) - 2):
        a = v[ia]
        for ib in range(ia + 1, len(v) - 1):
            b = v[ib]
            for ic in range(ib + 1, len(v)):
                c = v[ic]
                if (abs(a - b) < c) and (c < (a + b)):
                    if (a != b) and (b != c) and (c != a):
                        counter += 1
    print(counter)

if __name__ == '__main__':
    main()

Solution (Python):
import itertools
import itertools

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

ans = 0
for l1, l2, l3 in itertools.combinations(L, 3):
    if l1 == l2 or l2 == l3:
        continue
    
    if l3 < l1 + l2:
        ans += 1

print(ans)

Solution (Python):
from collections import Counter
from itertools import combinations

N = int(input())
L = Counter(list(map(int, input().split())))
ans = 0
for a, b, c in combinations(L.keys(), 3):
    if a+b>c and b+c>a and c+a>b:
        ans += L[a]*L[b]*L[c]
print(ans)

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

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

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

res = 0
for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1

print(res)

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 not ((a != b) and (b != c) and (c != a)): continue
                if not ((a + b > c) and (b + c > a) and (c + a > b)): continue
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import itertools
N=int(input())
L=list(map(int,input().split()))
L=sorted(L)
c=0
for i in range(N):
    for j in range(i):
        for k in range(j):
            if L[j]-L[k]<L[i]<L[j]+L[k] and L[j]!=L[k]and L[j]!=L[i] and L[i]!=L[k]:
                c+=1
print(c)

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

if(N <= 2):
  print(0)
  exit()

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):
import itertools
N = int(input())
l = list(map(int,input().split()))
count = 0

for i in itertools.combinations(l,3):
    a = i[0]
    b = i[1]
    c = i[2]
    if a!=b and b!=c and c!=a:
        if a+b>c and b+c>a and c+a>b:
            count +=1
print(count)

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

print(ret)

Solution (Python):



N = input()
L = input().split(' ')

l = len(L)
L = [int(s) for s in L]
L.sort()
  
a = 0
for i in range(l - 2):
    for j in range(i + 1, l - 1):
        for k in range(j + 1, l):
            if (L[i] + L[j]) > L[k]:
                if (L[i] != L[j]) and (L[k] != L[j]) and (L[i] != L[k]):
                    a += 1
print(int(a))

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

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

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

cnt = 0

for i in range(len(l)):
    j = i + 1
    for j in range(len(l)):
        k = j + 1
        for k in range(len(l)):
            a = l[i]
            b = l[j]
            c = l[k]
            if (a < b < c) and (((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()))

l.sort()

if n < 3:
    print(0)
    exit()

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

print(cnt)

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

ans = 0
if N >= 3:
    for p in range(N):
        P = L[p]
        for q in range(p+1,N):
            Q = L[q]
            for r in range(q+1,N):
                R = L[r]
                if P!=Q and Q != R and R != P :
                    if P+Q>R and Q+R>P and R+P>Q:
                        ans += 1
print(ans)

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

Solution (Python):



def main():
    from itertools import combinations
    import sys
    input = sys.stdin.readline

    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)


if __name__ == '__main__':
    main()

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

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

llist.sort()
answer=0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):      
      if llist[i]<llist[j]<llist[k] and llist[i]+llist[j]>llist[k]:
        
        answer+=1
        
print(answer)

Solution (Python):



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

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

Solution (Python):



def main():
    from itertools import combinations
    import sys
    input = sys.stdin.readline

    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]

        total = a + b + c
        max_value = max(a, b, c)
        diff = total - max_value

        if a == b:
            continue
        if b == c:
            continue
        if c == a:
            continue

        if diff <= max_value:
            continue

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
L = inpl()

cnt = 0
for i,j,k in itertools.combinations(L,3):
    if i != j and j != k and k != i and max(i,j,k) < (i+j+k) - max(i,j,k):
        cnt += 1

print(cnt)

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 not ((a != b) and (b != c) and (c != a)): continue
                if not ((a + b > c) and (b + c > a) and (c + a > b)): continue
                ans += 1

    print(ans)


if __name__ == "__main__":
    main()

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

cnt = 0

for i in range(0, n-2):
    t = l[i]
    for b in range(i+1, n-1):
        s = l[b]
        if (t != s):
            for k in range(b+1, n):
                a = s + l[k]
                if(a > t and s != l[k]):
                    cnt += 1

print(cnt)

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import copy
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


def solve():
    N = Scanner.int()
    L = Scanner.map_int()
    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] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
                    ans += 1
    print(ans)


def main():
    
    
    solve()


if __name__ == "__main__":
    main()

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

ans = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            tmp = [L[i],L[j],L[k]]
            if len(set(tmp)) == 3 and max(tmp) < sum(tmp)/2:
                ans += 1

print(ans//6)

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

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

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

Solution (Python):
def is_triangle(a, b, c):
    return len({a, b, c})==3 and a+b>c and b+c>a and c+a>b

n = int(input())
if n <= 2:
    print(0)
    exit()
*l, = 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 is_triangle(l[i], l[j], l[k]):
                ans += 1
print(ans)

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

def check_tri(x):
  x = sorted(x)
  
  if x[0]==x[1] or x[0]==x[2] or x[1]==x[2]:
    return 0
  elif x[2]<x[0]+x[1]:
    return 1
  else:
    return 0
s = 0
for i in range(0,n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      a,b,c = l[i],l[j],l[k]
      
      x =check_tri([a,b,c])
      
      s+=x
print(s)

Solution (Python):
from collections import Counter
import itertools 

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

S = list(set(L))

ans = 0
for a, b, c in itertools.combinations(S, 3):
    if a + b > c and a + c > b and b + c > a:
        ans += (C[a]*C[b]*C[c])

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


from itertools import combinations
from collections import Counter as cc
def main():
    def check(a, b, c):
        return a+b > c

    n = ii()
    l = li()
    l = cc(l)
    x = list(combinations(l.keys(), 3))

    cnt = 0
    for a, b, c in x:
        if check(a, b, c) and check(b, c, a) and check(c, a, b):
            cnt += l[a]*l[b]*l[c]
    print(cnt)



if __name__ == '__main__':
    main()

Solution (Python):
import itertools
n = int(input())
l = list(map(int, input().split()))
ans = 0
comb = itertools.combinations(l, 3)
for i in comb:
    if len(set(i)) == 3:
        if (i[0] + i[1]) > i[2] and (i[1] + i[2]) > i[0] and (i[2] + i[0]) > i[1]:
            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):
        if L[i] == L[j]:
            continue
        for k in range(j+1, N):
            if L[k] >= L[i] + L[j]:
                break
            if L[j] == L[k]:
                continue
            ans += 1
print(ans)

Solution (Python):
from itertools import combinations

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

ans = 0
for a, b, c in combinations(l, 3):
    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(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] and l[j] + l[k] > l[i] and l[k] + l[i] > l[j]:
                cnt += 1
print(cnt)

Solution (Python):

N = int(input())
L_L = [int(x) for x in input().split()]

L_L.sort()
ans = 0

for i in range(N):
    _li = L_L[i]
    for j in range(i+1, N):
        _lj = L_L[j]
        if _li == _lj:
            continue
        for k in range(j+1, N):
            _lk = L_L[k]
            if _li == _lk or _lj == _lk:
                continue
            if _li + _lj > _lk:
                ans += 1


print(ans)

Solution (Python):

import sys
import math

input = sys.stdin.readline


def inp():
    return(int(input()))

def inps():
    return str(input())
    
def inlt():
    return(list(map(int,input().split())))
    
def inlst():
    return(list(map(str,input().split())))
    
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split())) 

def tri(arr):
    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] or arr[i]==arr[k] or arr[k]==arr[j]:
                    continue
                if arr[i]+arr[j]>arr[k] and arr[i]+arr[k]>arr[j] and arr[k]+arr[j]>arr[i]:
                    cnt+=1
    return cnt
n = inp()
arr = inlt()
print(tri(arr))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(N):
	for j in range(N):
		for k in range(N):
			if a[i] + a[j] + a[k] - max(a[i], a[j],a[k]) > max(a[i], a[j],a[k]) and a[i] != a[j] and a[i] != a[k] and a[k] != a[j]:
				count += 1
count = count //6
print(count)

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

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 or b == c or c == a:
                continue
            if a + b > c and b + c > a and c + a > b:
                cnt += 1
print(cnt)

Solution (Python):
N=int(input())
S=list(map(int,input().split()))
s=list(set(S))
s.sort()
x=len(s)
Z=0
for i in range(x-1):
  a=s[i]
  A=S.count(a)
  for j in range(x-i-1):
    b=s[i+1+j]
    B=S.count(b)
    t=[i for i in S if i>b and i<a+b]
    T=len(t)
    Z+=A*B*T
print(Z)

Solution (Python):

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

print(M)

Solution (Python):
import itertools
n = int(input())
l = [int(i) for i in input().split()]
ls = list(itertools.combinations(range(n),3))
ans = 0
if n < 3:
    print(0)
else:
    for i in range(len(ls)):
        index_ls = list(ls[i])
        tmp_ls = [l[index_ls[0]],l[index_ls[1]],l[index_ls[2]]]
        tmp_ls.sort()
        if tmp_ls[0] + tmp_ls[1] > tmp_ls[2]:
            if tmp_ls[0] == tmp_ls[1] or tmp_ls[1] == tmp_ls[2] or tmp_ls[0] == tmp_ls[2]:
                continue
            else:
                ans += 1
    print(ans)

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))
c = 0

for l in ls:
    for other_l1 in [i for i in ls if i != l]:
        for other_l2 in [i for i in ls if i not in [l, other_l1]]:
            new_l = [l, other_l1, other_l2]
            new_l.sort()
            if new_l[0] + new_l[1] > new_l[2]:
                c += 1

print(int(c / 6))

Solution (Python):
N=int(input())
L=[int(i) for i in input().split()]
cnt=0
if N<3:print(0)
else:
	for i in range(N):
		for j in range(i):
			for k in range(j):
				if (L[i]-L[j])*(L[j]-L[k])*(L[k]-L[i])!=0:
					if (L[i]+L[j]-L[k])>0 and  (L[j]+L[k]-L[i])>0 and  (L[i]+L[k]-L[j])>0:cnt+=1

	print(cnt)

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

L = sorted(L)

ln = len(L)

ans = 0

for i in range(ln-2):
   for j in range(i+1, ln-1):
      for k in range(j + 1, ln):
         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())
S=list(map(int,input().split()))
s=list(set(S))
s.sort()
x=len(s)
Z=0
for i in range(x-1):
  a=s[i]
  A=S.count(a)
  for j in range(x-i-1):
    b=s[i+1+j]
    B=S.count(b)
    t=[i for i in S if i>b and i<a+b]
    T=len(t)
    Z+=A*B*T
print(Z)

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):
            x=L[i]+L[j]-L[k]
            y=L[j]+L[k]-L[i]
            z=L[k]+L[i]-L[j]
            if min(x,y,z)>0 and len({L[i],L[j],L[k]})==3:
                ans+=1
print(ans)

Solution (Python):



import bisect

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]:
            pass
        else:
            ab=L[i]+L[j]
            c=bisect.bisect_left(L,ab)
            bequalc=bisect.bisect_right(L,L[j])
            ans+=c-(bequalc)

print(ans)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
L = LI()
c = itertools.combinations(L, 3)
ans = 0
for i, j, k in c:
    if i+j > k and j+k > i and i+k > j and i != j and j != k and k != i:
        ans += 1
print(ans)

Solution (Python):
N = int(input())
ls_L = list(map(int,input().split()))
ls_L.sort()
  
ans = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            a = ls_L[i]
            b = ls_L[j]
            c = ls_L[k]
            if c < a + b:
                if (a - b) * (b - c) * (c - a) != 0:
                    ans += 1
                    
print(ans)

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

l = list(map(int,input().split()))
l.sort()
t = 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[i] == l[k]:
                continue
            else:
                if l[i] + l[j] > l[k]:
                    t += 1
print(t)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    L = LI()
    cnt = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                    continue
                if abs(L[i] - L[j]) < L[k] and L[k] < L[i] + L[j]:
                    cnt += 1
    print(cnt)

main()

Solution (Python):
import itertools

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

for a, b, c in itertools.combinations(l, 3):
    a, b, c = sorted([a, b, c])
    if a != b and b != c and c < a + b:
        cnt += 1
print(cnt)

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

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

Solution (Python):

import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9+7
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]





n=Int()
a=sorted(array())

ans=0

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

print(ans)

Solution (Python):
n = int(input().rstrip())
edgeList = [int(x) for x in input().rstrip().split(" ")]
cnt = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    if edgeList[i] != edgeList[j]:
      for k in range(j+1, n):
        cnt += (edgeList[i] != edgeList[k] and 
                edgeList[j] != edgeList[k] and 
                edgeList[i] + edgeList[j] > edgeList[k] and 
                edgeList[j] + edgeList[k] > edgeList[i] and 
                edgeList[k] + edgeList[i] > edgeList[j])
print(cnt)

Solution (Python):
import itertools
n = int(input())
l = sorted(list((map(int, input().split()))))
res = 0
pos = list(itertools.combinations(l, 3))
for pos_i in pos:
    pos_i = sorted(list(pos_i))
    if len(set(pos_i)) < 3:
        continue
    if pos_i[-1] < pos_i[0] + pos_i[1]:
        res += 1
print(res)

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

c=list(itertools.combinations(list(range(1,n+1)),3))
ans=0
for i in c:
  if i[0]<i[1] and i[1]<i[2]:
    
    s=sorted(set([l[i[0]-1], l[i[1]-1], l[i[2]-1]]))
    if len(s) == 3:
      if s[-1] < s[0]+s[1]:
        ans+=1
        
      
print(ans)

Solution (Python):
N = int(input())
b = [int(s) for s in input().split()]
a = int(0)

if N == 1 or N == 2:
  print("0")
else:
  for i in range(N-2):
    for k in range(int(i)+1, N-1):
      for h in range(int(k)+1, N):
        if b[i] != b[k] and b[i] != b[h] and b[k] != b[h]:
          if b[i] + b[k] + b[h] - max([b[i], b[k], b[h]]) > max([b[i], b[k], b[h]]):
            a = a+1
          else:
            pass
        else:
          pass
  print(a)

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

n = int(input())
*a, = map(int, input().split())
cnt = 0
for i in range(n):
	for j in range(i):
		for k in range(j):
			x, y, z = sorted([a[i], a[j], a[k]])
			if z < x + y and x != y and y != z:
				cnt += 1
print(cnt)

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

print(ans)