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

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

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

print(cnt)

Solution (Python):
import itertools

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

p = list(itertools.combinations(array, 3))

count = 0

for p_i in p:
    if p_i[0] + p_i[1] > p_i[2]:
        if p_i[1] + p_i[2] > p_i[0]:
            if p_i[2] + p_i[0] > p_i[1]:
                if p_i[0] != p_i[1] and p_i[1] != p_i[2] and p_i[2] != p_i[0]:
                    count = count + 1

print(count)

Solution (Python):
def main():
    n = int(input())
    L = sorted([int(x) for x in input().split()])
    cnt = 0
    for a in range(n-2):
        for b in range(a+1, n-1):
            for c in range(b+1, n):
                if (L[a] != L[b]) and (L[b] != L[c]) and (L[c] != L[a]) and \
                    L[a] + L[b] > L[c]:
                    cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
L = [int(i) for i in input().split()]
L.sort()
Ln = []
cnt = 1
for j in range(1,N):
    if L[j-1]==L[j]:
        cnt+=1
        if j==N-1:
            Ln.append(cnt)
    else:
        Ln.append(cnt)
        cnt=1
        if j==N-1:
            Ln.append(cnt)
L1 = list(set(L))
L1.sort()
len_L1 = len(L1)
tri = 0
for k in range(len_L1-2):
    for l in range(k+1,len_L1-1):
        for m in range(l+1,len_L1):
            if (L1[k]+L1[l])>L1[m]:
                tri += Ln[k]*Ln[l]*Ln[m]
print(tri)

Solution (Python):
a=int(input())
arr=list(map(int,input().split()))
count=0
s=set(arr)
brr=[]
d=dict()
count=0
for i in range(0,len(arr)):
    for j in range(i+1,len(arr)):
        for k in range(j+1,len(arr)):
            brr=[arr[i],arr[j],arr[k]]
            brr.sort()
            if(brr[0]+brr[1]>brr[2]):
                if((not brr[0]==brr[1]) and (not brr[1]==brr[2]) and (not brr[2]==brr[1])):
                    count=count+1
                

print(count)

Solution (Python):
from statistics import median
import itertools
N = int(input())
L = list(map(int, input().split()))
L = list(itertools.combinations(L,3))
c = len(L)
for l in L:
  l = list(l)
  m = max(l)
  if len(set(l)) < 3:
    c -= 1
  elif m >= (median(l) + min(l)):
    c -= 1

print(c)

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

print(c)

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

    ans = 0
    for L in list(itertools.combinations(Ls, 3)):

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

print(ans)

Solution (Python):

x = int(input())
lis = list(map(int, input().split()))
count = 0

for i in range(x):
  mag=lis[i]
  for s in range(x):
    len=lis[s]
    for t in range(x):
        pas=lis[t]
        if pas == len or len == mag or mag == pas:
            count=count
        elif abs(pas-mag)<len<pas+mag:
            count = count+1
        else:
            count = count


ans = int(count/6)
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
count = 0
def make_sankaku(san):
    if san[0] == san[1] or san[1] == san[2] or san[2] == san[0]:
        return False
    else:
        san.sort()
        if san[2] - san[0] >= san[1]:
            return False
    return True
All_a = []
if len(A) <3:
    count = 0
else:
    for i in range(len(A)):
        for k in range(i+1, len(A)):
            for l in range(k + 1 ,len(A)):
                if make_sankaku([A[i], A[k], A[l]]):
                    if [A[i], A[k], A[l]] not in All_a:
                        count += 1
print(count)

Solution (Python):
import itertools

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

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


for pair in itertools.combinations(L, 3):
    
    if has_duplicates(pair) == False:

        if (pair[0] + pair[1] > pair[2]) and (pair[1] + pair[2]) > pair[0] \
                and (pair[2] + pair[0] > pair[1]):
            count += 1





print(count)

Solution (Python):
import itertools
n=int(input())
seq=list(map(int,input().split()))
ans=0
for li in list(itertools.combinations(seq,3)):
  if(li[0]+li[1]>li[2] and li[1]+li[2]>li[0] and li[0]+li[2]>li[1]):
    if(li[0]!=li[1] and li[1]!=li[2] and li[0]!=li[2]):
      ans+=1

print(ans)

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

if n < 3:
  print(0)
else:
  cnt = 0
  for i in range(n-2):
    for s in range(i+1,n-1):
      for t in range(s+1,n):
        x = int(l[i])
        y = int(l[s])
        z = int(l[t])
        if x != y and x != z and y != z:
          
          if x > y and x > z and x < (y+z):
            cnt += 1
          elif y > x and y > z and y < (x+z):
            cnt += 1
          elif z > x and z > y and z < (x+y):
            cnt += 1
  print(cnt)

Solution (Python):
from sys import stdin
import itertools

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

tmp = set()
cnt = 0
for s in itertools.combinations(L, 3):
    a = s[0]
    b = s[1]
    c = s[2]
    if a+b > c and b+c > a and c+a > b:
        if a != b and b != c and a != c:
            cnt = cnt + 1

print(cnt)

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

ans = 0
for i in range(0, len(ls)):
  for j in range(i+1, len(ls)):
    for k in range(j+1, len(ls)): 
      length = ls[i] + ls[j] + ls[k]
      if length - 2 * max(ls[i], ls[j], ls[k]) > 0:
        ans += l.count(ls[i]) * l.count(ls[j]) * l.count(ls[k])
        
print(ans)

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
Ls = set(L)
Lslist = list(Ls)
LsSortlist = sorted(Lslist)
LSl = LsSortlist
tc = 0
for i in range(len(LSl)):
  L1 = LSl[i]
  for j in range(i + 1, len(LSl)):
    L2 = LSl[j]
    MinL = L2 - L1
    MaxL = L2 + L1
    for k in range(j + 1, len(LSl)):
      L3 = LSl[k]
      if MinL >= L3:
        continue
      elif L3 >= MaxL:
        break
      else:
        tc += L.count(L1) * L.count(L2) * L.count(L3)
if n < 3:
  print(0)
else:
  print(tc)

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

count = 0
for i in range(N):
  a1 = i+1
  if a1 > N:
    break
  for j in range(N):
    a2 = a1 + j + 1
    if a2 > N:
      break
    for k in range(N):
      a3 = a2 + k + 1
      if a3 > N:
        break
      a = [L[a1-1],L[a2-1],L[a3-1]]
      a.sort()
      if a[0] != a[1] and a[1] != a[2]:
        if a[0]+a[1] > a[2]:
          count = count + 1
        else:
          None
      else:
        None
print(count)

Solution (Python):
import numpy
import itertools

if __name__ == "__main__":
  N = int(input())
  L = [int(a) for a in input().split()]
  cnt = 0
  L_comb = list(itertools.combinations(L, 3))
  for i in L_comb:
    if len(set(i)) <= 2:
      continue
    i = numpy.asarray(i)
    max_index = numpy.argmax(i)
    if i[max_index] < sum(i) - i[max_index]:
      cnt += 1
    else:
      pass   
  print(cnt)

Solution (Python):
import itertools
N=int(input())
l=list(map(int,input().split()))
ctn=0
for c  in itertools.combinations(l, 3):
    if len(c)==len(set(c)):
        if sorted(c)[0]+sorted(c)[1]-sorted(c)[2]>0:
            ctn+=1
print(ctn)

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

ans = 0

for i in range(a):
    for j in range(1, a):
        for k in range(2, a):
            if x[i] == x[j] or x[i] == x[k] or x[j] == x[k]:
                continue
            if i > j or i > k or j > k:
                continue
            res = x[i] - x[j]
            res *= -1 if res < 0 else 1
            if res < x[k] and x[k] < (x[i] + x[j]):
                ans += 1
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
num_list =[]
ans = 0
for i in range(N):
  for j in range(N):
    for k in range(N):
      if L[i]!=L[j] and L[j]!=L[k] and L[i]!=L[k]:
        num_list.append(L[i])
        num_list.append(L[j])
        num_list.append(L[k])
        num_list.sort()
        if num_list[0]+num_list[1] > num_list[2]:
          ans += 1
          num_list.clear()
        else:
          num_list.clear()
print(int(ans/6))

Solution (Python):
N = int(input())
Lall = input()
L_l = Lall.split()
L_l_spl = [int(n) for n in L_l]
L = sorted(L_l_spl)
c=0
for x in range(N-2):
  for y in range(x+1,N-1):
    if L[x] == L[y]:
      pass
    else:
      for z in range(y+1,N):
        if L[z] == L[y]:
          pass
        else:
          xy = L[x] + L[y]
          zint = L[z]
          if zint < xy:
            c = c + 1
print(c)

Solution (Python):

import os
import sys
from io import BytesIO, IOBase

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


from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y

def solve(N, A):
    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] and A[i] + A[j] > A[k] and A[i] + A[k] > A[j] and A[k] + A[j] > A[i]:
                    
                    ans += 1
    return ans

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

print(solve(N, A))

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

import collections
c = collections.Counter(ls)

Ls = list(set(ls))
Ls.sort()

if len(Ls) < 3:
  print(0)
else:
  ans = 0
  LsR = sorted(Ls)
  while len(LsR) >= 3:
    L1 = LsR[0]
    Ls1 = LsR[1:]
    while len(Ls1) >= 2:
      L2 = Ls1[0]
      Ls2 = Ls1[1:]
      for L3 in Ls2:
        if L3 < L1 + L2 and L3 > abs(L1-L2):
          ans += c[L1] * c[L2] * c[L3]
      Ls1 = Ls1[1:]
    LsR = LsR[1:]
  print(ans)

Solution (Python):
import itertools

n = int(input())
l = sorted(map(int,input().split()))
ans = 0
li =  []
c = 0
for team in itertools.combinations(l, 3):
    li.append(list(team))
    c  += 1
sum = 0
for i in range(c):
    if li[i][0] != li[i][1] and li[i][1] != li[i][2] and li[i][2] != li[i][0]:
        if li[i][0] + li[i][1] > li[i][2]:
            ans += 1
print(ans)

Solution (Python):

import itertools
N = int(input())
L = input().split()
L = [int(i) for i in L]
count = 0
if(len(L) > 2):
  for comb in itertools.combinations(L, 3):
    comb = list(comb)
    if(len(set(comb))==3):
      if(comb[0]+comb[1] > comb[2]):
        if(comb[1]+comb[2] > comb[0]):
          	if(comb[2]+comb[0] > comb[1]):
          		count += 1
print(count)

Solution (Python):

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

count = 0

for i  in range(0, N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            box = [A[i], A[j], A[k]]
            if len(box) == len(set(box)):
            	if (A[i] + A[j] > A[k]) and (A[j] + A[k] > A[i]) and (A[i] + A[k] > A[j]):
                	count += 1

print(count)

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
cou=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]:
        a=max(l[i],l[j],l[k])
        if a<l[i]+l[j]+l[k]-a:
          cou+=1
print(cou)

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

Solution (Python):
from itertools import combinations
n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0
for i in comb:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)

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

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

print(ans)

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


    return count

n = int(input())
arr = [int(x) for x in input().split()]
print(findNumberOfTriangles(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,n):
    for k in range(j,n):
      if ((l[i] != l[j]) & (l[j] != l[k]) & (l[k] != l[i])):
        if(l[i]+l[j]>l[k]) & (l[j]+l[k] > l[i]) & (l[k] + l[i] > l[j]):
          ans += 1
        
print(ans)

Solution (Python):
n = int(input())
l = input()
a = l.split(' ')
new_l = []
countl = 0

for i in range(n):
    new_l.append(int(a[i]))

new_l.sort()

for i in range(n):
    for j in range(i+1,n-i):
        if(new_l[i]==new_l[j]):
            countl += 1

count = 0

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

print(count)

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

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

Solution (Python):
import itertools
  
n = int(input())
l = list(map(int, input().split()))
index_list = [i for i in range(n)]

def is_triangle(a, b, c):
    if a + b <= c:
        return False
    if b + c <= a:
        return False
    if c + a <= b:
        return False
    if abs(a - b) >= c:
        return False
    if abs(b - c) >= a:
        return False
    if abs(c - a) >= b:
        return False
    return True

ans = 0
for i1, i2, i3 in itertools.permutations(index_list, 3):

    if l[i1] != l[i2] and l[i2] != l[i3] and l[i1] != l[i3]:
    
        if i1 < i2 < i3:
            if is_triangle(l[i1], l[i2], l[i3]):
                
                ans += 1
print(ans)

Solution (Python):
import itertools

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

unqL = list(set(L))
Lnums = {}
for l in unqL:
    Lnums[l] = L.count(l)

cnt = 0    
for cmb in itertools.combinations(unqL, 3):
    cmb = sorted(cmb)
    l1, l2, lmax = cmb    
    if l1 + l2 > lmax:
        cnt += Lnums[l1] * Lnums[l2] * Lnums[lmax]
    
print(cnt)

Solution (Python):
def second_smallest(numbers):
    m1, m2 = float('inf'), float('inf')
    for x in numbers:
        if x <= m1:
            m1, m2 = x, m1
        elif x < m2:
            m2 = x
    return m2

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

Solution (Python):
import numpy as np
num = int(input())
data = list(map(int ,input().split()))
count =0
for i in range(num):
  for j in range(num-1):

    if (i>j):
      continue
    for k in range(num-2):
    
      if (j>k):
        continue
      datalist = [data[i],data[j+1],data[k+2]]
      max_i=np.argmax(datalist)
      
      if(datalist[max_i]<(datalist[(max_i+1)%3]+datalist[(max_i+2)%3])and not datalist[0]==datalist[1] and not datalist[1]==datalist[2] and not datalist[2]==datalist[0]):
        
        count +=1
      
      
print(count)

Solution (Python):
def main():
    n = int(input())
    l = list(map(int, input().split()))
    ll = len(l)
    ans = 0

    for i in range(ll):
        for j in range(i+1, ll):
            for k in range(j+1, ll):
                if len(set([l[i], l[j], l[k]])) != 3:
                    continue
                item = [l[i], l[j], l[k]]
                if max(item) < sum(item) - max(item):
                    ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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


def main():
    n = int(input())
    ls = list(map(int, input().split()))
    ls_count = Counter(ls)
    ls_keys = list(ls_count.keys())
    m = len(ls_keys)
    ans = 0
    for i in range(m-2):
        c = ls_keys[i]
        pairs = list(comb(ls_keys[(i+1):], 2))
        for a, b in pairs:
            if c + a > b and a + b > c and b + c > a:
                ans += ls_count[c] * ls_count[a] * ls_count[b]
    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(1, n):
        for k in range(2, n):
            if i < j and j < k:
                if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                    if l[i] + l[j] > l[k]:
                        ans += 1

print(ans)

Solution (Python):
from itertools import combinations
n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0
for i in comb:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)

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

ans = 0
if len(L) <= 2 :
    print(ans)
else:
    for lists in itertools.combinations(L,3):
        if sum(lists) - max(lists) > max(lists):
            if len(lists) != len(set(lists)):
                continue
            else:
                ans += 1


        else:
            continue
    print(ans)

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

print(str(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):
        if L[i] != L[j]:
            for k in range(j + 1, n):
                if not(L[i] == L[k] or L[j] == L[k]):
                    a, b, c = sorted([L[i], L[j], L[k]])
                    if c < a + b:
                        ans += 1
print(ans)

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

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

print(len(nums))

Solution (Python):
N = int(input())
L = 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] 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()))

L.sort()

cnt = 0
comb = []
for i in range(N-2):
  for j in range(i+1,N-1):
    for k in range(i+2,N):
      if L[i] < L[j] < L[k] :
        comb.append([L[i],L[j],L[k]])
        
for i in range(len(comb)):
  X = comb[i][0] + comb[i][1]
  if X > comb[i][2]:
    cnt += 1
print(cnt)

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

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools










N = int(input())
L = [int(i) for i in input().split()]
L.sort()
SL = set(L)
ans = 0

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

    print(ans)

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

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

ans = 0
for i,j,k in combinations(l, 3):
  if i != j and j != k and i != k and i+j > k and i+k > j and j+k > i: ans += 1
print(ans)

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

Solution (Python):
import itertools

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

def judge(arg1,arg2,arg3):
    if arg1 == arg2 or arg1 == arg3 or arg3 == arg2:
        return 0
    elif arg1 + arg2 > arg3 and arg2 + arg3 > arg1 and arg1 + arg3 > arg2:
        return 1
    else:
        return 0








for pairs in itertools.combinations(L,3):
    if judge(*pairs):
        cnt += 1

print(cnt)

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

Solution (Python):

_INPUT = """\
5
4 4 9 7 5
"""

def main():
    N = int(input())
    sido = list(map(int, input().split()))
    triangle = list(itertools.combinations(sido, 3))
    

    
    j = 0
    for i in range(len(triangle)):
        if len(triangle[i]) != len(set(triangle[i])):
            continue

        if ((triangle[i][0] + triangle[i][1] > triangle[i][2])
           & (triangle[i][1] + triangle[i][2] > triangle[i][0])
           & (triangle[i][0] + triangle[i][2] > triangle[i][1])):
           j += 1
           
    print(j)


if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools

    
    main()

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

i = 0
while i < n - 2:
  j = i + 1
  while j < n - 1:
    k = j + 1
    while k < n:
      d = ls[i] + ls[j] + ls[k]
      mx = max(ls[i], max(ls[j], ls[k]))
      if ls[i] == ls[j] or ls[j] == ls[k] or ls[k] == ls[i]:
        k += 1
        continue
      if mx < d - mx:
        ans += 1
        
      k += 1
    j += 1
  i += 1

print(ans)

Solution (Python):
import itertools
import math
n=int(input())
l=list(map(int,input().split()))
if len(l)<=2:
    print('0')
else:
    c = list(itertools.combinations(l, 3))
    count=0
    r=math.factorial(len(l)) // (math.factorial(len(l) - 3) * 6)
    for i in range(r):
        if c[i][0]==c[i][1] or c[i][1]==c[i][2] or c[i][2]==c[i][0]:
            pass
        else:
            if c[i][0]+c[i][1]>c[i][2] and c[i][1]+c[i][2]>c[i][0] and c[i][2]+c[i][0]>c[i][1]:
                count+=1
            else:
                pass
    print(count)

Solution (Python):
import itertools
N = int(input())
N_List =list(map(int,input().split()))
cnt = 0
for pairs in itertools.permutations(N_List, 3):
    if len(set(pairs)) == 3:
        if list(pairs) == sorted(list(pairs)):
            a = list(pairs)
            if a[0] + a[1] > a[2]:
                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):
            if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                continue
            hens = []
            hens.append(l[i])
            hens.append(l[j])
            hens.append(l[k])
            hens.sort()
            if hens[0] + hens[1] > hens[2]:
                cnt += 1

print(cnt)

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

for i in range(s):
  for j in range(i+1,s):
    for k in range(j+1,s):
      
      if a[i]==a[j]: continue
      if a[j]==a[k]: continue
      if a[k]==a[i]: continue

     
      ij = a[i]+a[j]
      jk = a[j]+a[k]
      ki = a[k]+a[i]
      
      
      if (ij > a[k]) and (jk > a[i])and (ki > a[j]):
        
        count +=1
print(count)

Solution (Python):
import itertools

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



cnt = 0

for x in itertools.combinations(L, 3):
    if x[0]==x[1] or x[1]==x[2] or x[0]==x[2]:
        continue

    if x[0]+x[1] < x[2]:
        continue
    if x[1]+x[2] < x[0]:
        continue
    if x[0]+x[2] < x[1]:
        continue

    if x[0] > x[1]:
        if x[0]-x[1] >= x[2]:
            continue
    else:
        if x[1]-x[0] >= x[2]:
            continue
        
    if x[1] > x[2]:
        if x[1]-x[2] >= x[0]:
            continue
    else:
        if x[2]-x[1] >= x[0]:
            continue

    if x[0] > x[2]:
        if x[0]-x[2] >= x[1]:
            continue
    else:
        if x[2]-x[0] >= x[1]:
            continue
    
    cnt += 1

print(cnt)

Solution (Python):
import itertools

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

L = []

for i in itertools.combinations(l, 3):
    if len(set(i)) == 3 and (i[0]+i[1] > i[2]) and (i[1]+i[2] > i[0]) and (i[2]+i[0] > i[1]):
        L.append(i)

print(len(L))

Solution (Python):
import itertools
n = int(input())
l = [0 for _ in range(n)]
l = [int(s) for s in input().split()]




def solve(l_list):
    l_list = list(l_list)
    l_list.sort()
    
    l1 = l_list[0]
    l2 = l_list[1]
    l3 = l_list[2]
    if(l1 + l2 <=l3 or l1 == l2 or l1 == l3 or l3 == l2):
        
        return 0
    else:
        return 1
if(n < 3):
    print(0)
else:
    l_koho = list(itertools.combinations(l,3))
    
    cnt = 0
    for x in l_koho:
        
        cnt += solve(x)

    print(cnt)

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

counter = 0
L = sorted(L,reverse=True)


first = 0

while first < len(L) - 2:
  second = first + 1
  while second < len(L) - 1:
    third = second + 1
    while third < len(L):
      if first != second and first != third and second != third:
        if L[first] != L[second] and L[second] != L[third] and L[first] < L[second]+L[third]:
          counter += 1
          
      third += 1
    second += 1
  first += 1

print(counter)