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())
a = list(map(int, input().split()))
triples = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            numbers = [a[i], a[j], a[k]]
            if len(set(numbers)) == 3:
                numbers = sorted(numbers)
                if numbers[0] + numbers[1] > numbers[2]:
                    triples += 1
print(triples)

Solution (Python):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    count = 0
    for i, l1 in enumerate(L):
        for j in range(i+1, len(L)):
            for k in range(j+1, len(L)):
                lengths = sorted([L[i], L[j], L[k]])
                if sum(lengths[:2]) > lengths[2]:
                    if len(set(lengths)) == 3:
                        count += 1
    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    L = list(map(int, input().split()))
    cnt = 0
    for i in range(len(L)):
        for j in range(i + 1, len(L)):
            for k in range(j + 1, len(L)):
                l = sorted([L[i], L[j], L[k]])
                if l[0] < l[1] and l[1] < l[2] and l[0] + l[1] > l[2]:
                    cnt += 1
    return cnt

if __name__ == '__main__':
    print(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):
    if L[i] == L[j]:
      continue
    for k in range(j + 1, N):
      if L[i] == L[k] or L[j] == L[k]:
        continue
      a = L[i]
      b = L[j]
      c = L[k]
      if a + b > c and b + c > a and c + a > b:
        cnt += 1


print(cnt)

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

import itertools
L.sort()
cL = list(itertools.combinations(L,3))

ans = 0
for tri in cL:
    if len(set(tri)) != 3:
        continue
    if tri[0] + tri[1] > tri[2]:
        ans += 1
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
if n<3:
  print(0)
  quit()

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

Solution (Python):

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

ans=0
from itertools import combinations
for a,b,c in combinations(L,3):
    if a+b>c and a!=b and b!=c:
        ans+=1
    
print(ans)

Solution (Python):
import itertools

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

li=itertools.combinations(l,3)
ans=0
for i in li:
    if i[0]==i[1] or i[1]==i[2] or i[0]==i[2]:
        continue

    temp=list(i)
    temp.sort()
    if temp[0]+temp[1]>temp[2]:
        ans+=1
        
print(ans)

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

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


def main():
    n = int(si())
    l = [int(e) for e in si().split()]
    if n < 3:
        print(0)
        return
    cnt = 0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                    temp = sorted([l[i], l[j], l[k]])
                    if temp[0]+temp[1] > temp[2]:
                        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-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] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j]:
                    cnt+=1
print(cnt)

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

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

Solution (Python):



import itertools

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

for x in itertools.combinations(L, 3):
    if len(set(x)) == 3:
        x = list(x)
        x.sort()
        if x[0] + x[1] > x[2]:
            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] > l[k] and len(set([l[i], l[j], l[k]])) == 3:
                
                count += 1
                
print(count)

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

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

L.sort()
ans=0
for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue   
            if L[i]+L[j] > L[k]:
                ans+=1
                

print(ans)

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

Solution (Python):
from itertools import combinations
_, l = input(), sorted(int(i) for i in input().split())
if len(l) < 3:
    print(0)
else:
    ans = 0
    for v in combinations(l, 3):
        if v[0] + v[1] > v[2] and len(set(v)) == 3:
            ans += 1
    print(ans)

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

def ok(a, b, c):
    return a < b + c and a > abs(b - c) and a != b and b != c and c != a

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

print(ans)

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

counter = 0

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


import itertools


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


ans = 0
for L_i, L_j, L_k in itertools.combinations(L, 3):
    if (L_i == L_j) or (L_j == L_k) or (L_k == L_i):
        continue
    if L_i + L_j + L_k > 2 * max(L_i, L_j, L_k):
        ans += 1


print(ans)

Solution (Python):
import sys
from io import StringIO
import unittest
import os
import itertools


sys.setrecursionlimit(999999999)


def triangle(a, b, c):
    
    if a + b > c and b + c > a and c + a > b:
        
        if a ** 2 == b ** 2 + c ** 2:
            return 0
        
        elif a ** 2 < b ** 2 + c ** 2:
            return 1
        
        elif a ** 2 > b ** 2 + c ** 2:
            return 2
    else:
        
        return 3



def resolve(test_def_name=""):
    
    n = int(input())
    l_s = list(map(int, input().split()))
    l_s.sort()

    
    

    cnt = 0
    aaa = list(range(n))

    for a in aaa:
        an = l_s[a]
        for b in aaa[a + 1:]:
            bn = l_s[b]
            if an == bn:
                continue
            for c in aaa[b + 1:]:
                cn = l_s[c]
                if bn == cn:
                    continue
                if triangle(an, bn, cn) < 3:
                    cnt += 1
    print(cnt)



class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """5
4 4 9 7 5"""
        output = """5"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """6
4 5 4 3 3 5"""
        output = """8"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """10
9 4 6 1 9 6 10 6 6 8"""
        output = """39"""
        self.assertIO(test_input, output)

    def test_input_4(self):
        test_input = """2
1 1"""
        output = """0"""
        self.assertIO(test_input, output)

    
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)



if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        
        resolve()

    else:
        
        unittest.main()

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

Solution (Python):
import numpy as np

n = int(input())
a = input().split()
nl=np.array(a, dtype=int)
count=0

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

print (count)

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

res = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            tmp = sorted([L[i], L[j], L[k]])
            if tmp[0] < tmp[1] < tmp[2] and (tmp[0] + tmp[1]) > tmp[2]:
                res += 1
print(res)

Solution (Python):


import copy
import random
import bisect 
import fractions 
import math
import sys
import collections
from decimal import Decimal 

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

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
L = LI()

"""
|A - B| < C |A + B|
"""

import itertools
cnt = 0
for v in itertools.permutations(L, 3):
    
    if len(set(v)) != 3 :
        continue

    a,b,c = v
    if abs(a - b) < c < a + b:
        cnt += 1
        



print(cnt // 6)

Solution (Python):
from itertools import combinations

N = int(input())
L = list(map(int, input().split()))
ans = 0
for items in combinations(L, 3):
    if sum(items) - max(items) > max(items):
        a, b, c = items
        if a != b and b != c and a != c:
            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+1,n):
        for k in range(j+1,n):
            if a[i] != a[j] and a[i] != a[k] and a[j] != a[k]:
                if a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and a[k] + a[i] > a[j]:
                    ans += 1
print(ans)

Solution (Python):

import sys
import numpy as np
import itertools


def solve(N: int, L: "List[int]"):
    ans = 0
    if len(L)>2:
        for c in itertools.combinations(L,3):
            if len(set(c))==3:
                if (c[0]+c[1]>c[2]) and (c[1]+c[2]>c[0]) and (c[2]+c[0]>c[1]):
                    ans += 1
    else:
        ans = 0
    print(ans)
    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):
from itertools import combinations


def main():
    n = int(input())
    L = [int(e) for e in input().split()]

    ans = 0
    for t in combinations(range(n), 3):
        i, j, k = t
        if L[i] < L[j] + L[k] and L[j] < L[i] + L[k] 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)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

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

combs = list(itertools.combinations(l, 3))
cnt = 0
for comb in combs:
    a = comb[0]
    b = comb[1]
    c = comb[2]
    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())
L = list(map(int,input().split()))

import itertools
ans = 0

C = itertools.combinations(L, 3)
for i in C:
  tmp = list(i)
  tmp.sort()
  if tmp[2] < tmp[0] + tmp[1]:
    if tmp[0] != tmp[1] and tmp[0] != tmp[2] and tmp[1] != tmp[2]:
      ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
l = [int(_) for _ in input().split()]
count = 0
for i,s1 in enumerate(l):
  for j,s2 in enumerate(l[i+1:]):
    for s3 in l[i+j+2:]:
      
      if len(set([s1, s2, s3]))!=3:
        continue
      elif ((s1+s2)>s3)&((s1+s3)>s2)&((s2+s3)>s1):
        count += 1
print(count)

Solution (Python):
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


N=int(input())
L=nl()
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[i]==L[k]):
                continue 
            if((L[i]+L[j])>L[k]):
                ans+=1

print(ans)

Solution (Python):
N = int(input())
L = [int(a) for a in input().split()]
count = 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):
                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()))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            if (abs(L[i] - L[j]) < L[k]) 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):
import itertools
def main():
    n = int(input())
    L = list(map(int, input().split()))


    comb = itertools.combinations(L, 3)
    ans = 0
    for a in list(comb):
        if len(a) == len(set(a)):
            max_len = max(a)
            sum_all = sum(a)
            if sum_all - max_len > max_len:
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

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

print(ans)

Solution (Python):
n = int(input())
p = list(map(int,input().split()))
import collections
import itertools
c = collections.Counter(p)
c_keys = list(c.keys())
com_list = list(itertools.combinations(c_keys, 3))

ans = 0
for i in range(len(com_list)):
    p_sort = sorted(com_list[i])
    if p_sort[0] + p_sort[1] > p_sort[2]:
        ans += c[p_sort[0]] * c[p_sort[1]] * c[p_sort[2]]

print(ans)

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+1,n-1):
        for x in range(j+1,n):
            if l[x]<l[i]+l[j] and l[i]<l[j]<l[x]:
                cnt+=1
                
print(cnt)

Solution (Python):
n=int(input())
ll=list(map(int,input().split()))
t=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if ll[i]==ll[j]:continue
      if ll[i]==ll[k]:continue
      if ll[k]==ll[j]:continue
      sa=[ll[i], ll[j], ll[k]]
      ma=max(sa)
      sal=sum(sa)-ma
      if ma<sal:t+=1
      
print(t)

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

cnt = 0

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

print(cnt)

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


q = sorted(L)
ans = 0
if n < 3:
  ans  = 0
elif n >= 3:
  for i in range(n - 2):
    for j in range(i+1, n -1 ):
      for k in range(j+1,n):
        if q[k] < q[i] + q[j] and q[i] != q[j] and q[j]  != q[k] and q[k] != q[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-2):
    for j in range(i,n-1):
        for k in range(j,n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a != b and b != c and c != a and a + b > c:
                ans += 1

print(ans)

Solution (Python):
import itertools

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

L.sort()

ans = 0
edge = list(itertools.combinations(L, 3))
for now in edge:
    if now[0] == now[1] or now[1] == now[2] or now[2] == now[0]:
        continue
    if now[0] + now[1] > now[2]:
        ans += 1

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

import itertools

ans = 0
for i, j, k in itertools.combinations(range(n), 3):
    if (l[i] == l[j]) or (l[i] == l[k]) or (l[j] == l[k]):
        continue
    else:
        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):
from itertools import combinations

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

result = 0
for lines in combinations(L, 3):
    if len(set(lines)) != 3:
        continue

    a, b, c = lines
    if a + b > c and b + c > a and c + a > b:
        result += 1

print(result)

Solution (Python):
number = int(input())
score = list(map(int,input().split()))
score.sort()
answer = 0
for i in range(len(score)):
    for j in range(len(score)-i-1):
        if score[i] != score[i+j+1]:
            for k in range(len(score)-i-j-2):
                if score[i+j+1] != score[i+j+k+2]:
                    if score[i]+score[i+j+1] > score[i+j+k+2]:
                        answer += 1
print(answer)

Solution (Python):





"""
"""

from collections import defaultdict
from itertools import combinations
import bisect

import sys
input = sys.stdin.readline

def solve(a):
    ans = 0
    for a1, a2, a3 in combinations(a,3):
        a_max = max(a1,a2,a3)
        if a1 + a2 + a3 > 2*a_max and a1 != a2 and a1 != a3 and a2 != a3:
            ans += 1
    print(ans)



            

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


if __name__ == "__main__":
    main()

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

Solution (Python):
import itertools

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

list_comb = list(itertools.combinations(L_list, 3))

result_sum = 0
for i in list_comb:
    if i[0] == i[1] or i[1] == i[2] or i[2] == i[0]:
        continue
    if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[2]+i[0]>i[1]:
        result_sum += 1
print(result_sum)

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

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

count = 0
for a in range(n):
    for b in range(a+1,n):
        for c in range(b+1,n):
            a_r = l_list[a]
            b_r = l_list[b]
            c_r = l_list[c]
            if a_r + b_r > c_r and b_r+c_r > a_r and c_r + a_r > b_r and a_r != b_r and b_r != c_r and c_r != a_r:
                count+=1
print(count)

Solution (Python):
def possible_triangle(x, y, z):
    length_req = (x + y > z) and (y + z > x) and (x + z > y)
    diff_sides = (x != y) and (x != z) and (y != z)
    return length_req and diff_sides


n = int(input())
sticks = [int(i) for i in input().split()]
sticks.sort()
count = 0

for i in range(n - 2):
    for j in range(i, n - 1):
        for k in range(j, n):
            if possible_triangle(sticks[i], sticks[j], sticks[k]):
                count += 1
print(count)

Solution (Python):
a = int(input())
l = sorted([int(x) for x in input().split()])
count = 0
for i in range(a):
    for j in range(i+1,a):
        if l[i] != l[j]:
            for k in range(j+1,a):
                if l[i]+l[j] >l[k] and l[i]!=l[k] and l[j]!=l[k]:
                    count += 1
print(count)

Solution (Python):
n=int(input())
a_list = 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) :
      a=a_list[i]
      b=a_list[j]
      c=a_list[k]
      if a+b>c and b+c>a and a+c>b and a!=b and b!=c and c!=a :
        count+=1
       
print(count)

Solution (Python):
import sys
import copy
from collections import deque
import collections
import itertools
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

def calc(a, b, c):
    if a==b or b==c or a==c:
        return False
    return a+b > c and b+c > a and a+c > b

_ = ni()
l = na()

cnt = 0
for a, b, c in itertools.combinations(l, 3):
    if calc(a, b, c):
        cnt += 1

print(cnt)

Solution (Python):
import itertools

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

a = list(itertools.combinations(l, 3))
ans = 0
for i in a:
    tmp = sorted(i)
    if tmp[0] != tmp[1] != tmp[2] and tmp[0]+tmp[1] > tmp[2]:
        ans += 1
print(ans)

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

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

Solution (Python):
from collections import Counter

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

l_counter = Counter(l)
l_set = sorted(list(l_counter.keys()))

length = len(l_set)
ans = 0
if n < 3:
    print(0)
else:
    for i in range(length - 2):
        for j in range(i + 1, length - 1):
            for k in range(j + 1, length):
                if l_set[k] < l_set[i] + l_set[j]:
                    ans += l_counter[l_set[i]] * l_counter[l_set[j]] * l_counter[l_set[k]]

    print(ans)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
r=0
for i in range(n):
	li=l[i]
	for j in range(i,n):
		lj=l[j]
		if li==lj:continue
		for k in range(j,n):
			lk=l[k]
			if li==lk or lj==lk:continue
			if li<lj+lk and lj<li+lk and lk<lj+li:r+=1
print(r)

Solution (Python):
from collections import deque
import sys, copy,itertools
input = sys.stdin.readline

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

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



cnt = 0

for i in range(len(JR)):
  if not(JR[i][0]==JR[i][1])and not(JR[i][1]==JR[i][2]) and (JR[i][0]+JR[i][1] > JR[i][2]):
    cnt += 1
    
print(cnt)

Solution (Python):
import sys,math
try:sys.stdin,sys.stdout=open('input.txt','r'),open('out.txt','w')
except:pass
from sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode
from collections import *;from math import ceil,floor,inf,factorial,gcd,log2,sqrt,log
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()


def lcm(a,b): return (a*b)//gcd(a,b)
def setbits(n):return bin(n).count('1')
def resetbits(n):return bin(n).count('0')
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r):
    num,den=1,1;r=min(n,n-r)
    for i in range(r):num*=(n-i);den*=(i+1)
    return num//den
def ncr_p(n, r, p):
    num,den=1,1;r=min(r,n-r)
    for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
    return (num * modinv(den,p)) % p
def isPrime(num) :
    if num<=1:return False
    if num==2 or n==3:return True
    if (num % 2 == 0 or num % 3 == 0) :return False
    m = int(num**0.5)+1
    for i in range(5,m,6):
        if (num % i == 0 or num % (i + 2) == 0) :return False
    return True
def bin_search(arr, low, high, val):
    while low <= high:
        mid = low + (high - low) // 2;
        if arr[mid] == val:return mid
        elif arr[mid] < val:low = mid + 1
        else:high = mid - 1
    return -1
def sumofdigit(num):
    count=0;
    while num : count+=num % 10;num //= 10;
    return count;
def inputmatrix():
    r,c=iia();mat=[0]*r;
    for i in range(r):mat[i]=iia();
    return r,c,mat;
def prefix_sum(n,arr):
    for i in range(1,n):arr[i]+=arr[i-1]
    return arr;
def binomial(n, k):
    if 0 <= k <= n:
        ntok = 1;ktok = 1
        for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
        return ntok // ktok
    else:return 0
def divisors(n):
    res = [];
    for i in range(1,ceil(sqrt(n))+1):
        if n%i == 0:
            if i==n//i:res.append(i)
            else:res.append(i);res.append(n//i)
    return res;


n= ii1()
arr = iia()

arr.sort()
count=0

n=len(arr)
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]:
                if arr[i]+arr[j]>arr[k] and arr[j]+arr[k]>arr[i] and arr[k]+arr[i]>arr[j]:
                    count+=1
print(count)

Solution (Python):
from collections import Counter

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

d = Counter(L)
l = list(set(L))
l.sort()

ans = 0
n = len(l)
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):
            if (abs(a-b) < l[k]) and l[k] < a+b:
                ans += d[a]*d[b]*d[l[k]]
print(ans)

Solution (Python):
from itertools import combinations

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

ls = list(combinations(L,3))

cnt = 0
for (i,j,k) in ls:
  if i != j and j != k and k != i:
    T = sorted([i,j,k])
    if T[2] < (T[0] + T[1]):
      cnt += 1
print(cnt)

Solution (Python):

n = int(input())

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

def sol(arr, n):

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

    return count


print (sol(arr, n))

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

Solution (Python):


n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n-2):
    for j in range(n-i-2):
        for k in range(n-i-j-2):
            len = a[i] + a[i+j+1] + a[i+j+k+2]
            ma = max(a[i],  a[i+j+1],  a[i+j+k+2])
            rest = len - ma

            if ma < rest:
                 if a[i] != a[i+j+1] and a[i+j+1] != a[i+j+k+2]:
                        if a[i+j+k+2] != a[i]:
                            cnt += 1


print(cnt)

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

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

print(ans)

Solution (Python):
import collections
N = int(input())
L = collections.Counter([int(T) for T in input().split()]).most_common()
Count = 0
for A in range(0,len(L)):
    for B in range(A+1,len(L)):
        for C in range(B+1,len(L)):
            if (L[A][0]+L[B][0]>L[C][0]) and (L[B][0]+L[C][0]>L[A][0]) and (L[C][0]+L[A][0]>L[B][0]):
                Count += L[A][1]*L[B][1]*L[C][1]
print(Count)

Solution (Python):

import sys
import itertools
import collections

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


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


n = I()
ll = list(MI())

count = collections.Counter(ll)


def check(a, b, c):
    if 2 * max(a, b, c) < (a + b + c):
        return True
    else:
        return False


ans = 0
for a, b, c in itertools.combinations(count.keys(), 3):
    if check(a, b, c):
        ans += count[a] * count[b] * count[c]

print(ans)

Solution (Python):
def check_tri(a, b, c):
  if a == b or a == c or b == c:
    return False
  return a + b > c and b + c > a and c + a > b

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

Solution (Python):
import itertools

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

for v in itertools.combinations(l,3):
    if v[0] != v[1] and v[1] != v[2] and v[2] != v[0]:
        if v[0]+v[1] > v[2] and v[1]+v[2] > v[0] and v[2]+v[0] > v[1]:
            count += 1

print(count)

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

res = 0
for i in range(len(ls)):
    for j in range(i+1,len(ls)):
        for k in range(j+1, len(ls)):
            a,b,c = ls[i],ls[j],ls[k]
            if a+b>c and b+c>a and c+a>b and a!=b and b!=c and c!=a:
                
                
                    
                res += 1

print(res)