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(map(int, input().split()))
l.sort(reverse=True)
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]:
                    cnt += 1
print(cnt)

Solution (Python):
import itertools
n = int(input())
l = list(map(int, input().split()))
nums = [i for i in range(len(l))]
ans = 0
for ptr in itertools.combinations(nums, 3):
    table = dict()
    cand = []
    for j in ptr:
        table[j] = l[j]
        cand.append(l[j])
    if len(set(cand)) == 3:
        k = sorted(table.items(), key=lambda x:x[1])
        if k[2][1] < k[0][1] + k[1][1]:
            ans += 1
print(ans)

Solution (Python):
n=int(input())
if n<=2:
  print(0)
  exit()
count=0
a = input().split(" ")
lista = [int(n) for n in a]

for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      b=lista[i]
      c=lista[j]
      d=lista[k]
      if b==c or c==d or d==b or b==c==d:
        continue
      if b+c>d and c+d>b and b+d>c:
        count+=1
print(count)

Solution (Python):
from itertools import combinations
class Bar:
  def __init__(self,num,length):
    self.num = num
    self.length = length
    
N = int(input())
T = list(map(int, input().split()))
bars = []
for n in range(N):
  bars.append(Bar(n,T[n]))

bars.sort(key = lambda x: x.length)
combi = list(combinations(bars,3))

ans = 0
for com in combi:
  if com[0].length == com[1].length or com[1].length == com[2].length:
    continue
  elif com[0].length + com[1].length <= com[2].length:
    continue
  else:
    ans += 1

print(ans)

Solution (Python):
import itertools
N = int(input())
l = list(map(int,input().split()))
ans = 0
if N >= 3:
  l.sort()
  l2 = list(itertools.combinations(l, 3))
  for i in range(len(l2)):
    if (l2[i][0] + l2[i][1] > l2[i][2]) and (l2[i][0] != l2[i][1] != l2[i][2]):
      ans += 1
print(ans)

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

Solution (Python):
import itertools

def choice_lst(n, choice_number):
    n_lst = []
    for i in range(n):
        n_lst.append(i)
    lst = list(itertools.combinations(n_lst, choice_number))
    return lst


def main():
    n = int(input())
    l_lst = list(map(int, input().split()))
    count = 0

    choices = choice_lst(n, 3)
    for i in range(len(choices)):
        tmp_lst = []
        for j in range(3):
            choiced_number = choices[i][j]
            tmp_lst.append(l_lst[choiced_number])

        tmp_lst.sort()
        l1 = tmp_lst[0]
        l2 = tmp_lst[1]
        l3 = tmp_lst[2]
        if l1 + l2 > l3 and l1 != l2 and l2 != l3:
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

N = int(input())
L = list(map(int,input().split()))
count = 0
for x in itertools.combinations(L,3):
  dup = [i for i in set(x) if x.count(i) > 1]
  if dup == [] and x[0] < x[1]+x[2] and x[1] < x[2] + x[0] and x[2] < x[0] + x[1]:
    count += 1
  
print(count)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
count = 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]:
                count += 1
print(count)

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

Solution (Python):


from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


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





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






print(res)

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

N = I()
L = LI()

count = 0
for i in range(N-2):
    for q in range(i+1,N-1):
        for r in range(q+1, N):
            
            if L[i] == L[q] or L[q]==L[r] or L[r]==L[i]:
                continue
            if L[i]+L[q]>L[r] and L[q]+L[r]>L[i] and L[r]+L[i]>L[q]:
                count += 1
                
            
            
            
            
print(count)

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

Solution (Python):
x = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
  for j in range(i+1,len(d)):
    for k in range(j+1,len(d)):
      temp = []
      temp.extend([d[i],d[j],d[k]])
      temp.sort()
      if temp[0] + temp[1] > temp[2] and len(list(set(temp))) == 3:
        count += 1
print(count)

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

N=int(input())
L=list(map(int,input().split()))
count=defaultdict(int)
for i in range(N):
    count[L[i]]+=1

L=list(set(L))
ans=0
for a,b,c in list(combinations(L,3)):
    if a>abs(b-c) and b>abs(c-a) and c>abs(a-b):
        ans+=count[a]*count[b]*count[c]
print(ans)

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


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

Solution (Python):
p = 0
n = int (input ())
l = [int (x) for x in input().split()]
list.sort (l)
x,y,z = 0,1,2
while x < len(l)-2:
  while y < len(l)-1:
    while z < len(l):
      if l[x]!=l[y] and l[x]!=l[z] and l[y]!=l[z] and l[z] < l[x]+l[y]:
        p += 1
      z += 1
    y += 1
    z = y+1
  x += 1
  y = x+1
  z = y+1
print (p)

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
counter = 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] 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]:
          counter += 1
print(counter)

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

Solution (Python):

import math
N = input()
ln = list(map(int, input().split()))
ans = 0
for i in range(0, len(ln) - 2):
    for j in range(i + 1, len(ln) - 1):
        for k in range(j + 1, len(ln)):
            l3 = [ln[i], ln[j], ln[k]]
            if ln[i] != ln[j] and ln[i] != ln[k] and ln[j] != ln[k] and \
                max(l3) < sum(l3) - max(l3):
                ans = ans + 1
print(ans)

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

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

print(count)

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

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

N = int(input())
sticks = [int(i) for i in input().split()]
c = Counter(sticks)
length_pattern = c.keys()
length_combinations = combinations(length_pattern, 3)

cnt = 0
for comb in length_combinations:
    if comb[0] < comb[1] + comb[2] and comb[1] < comb[2] + comb[0] and comb[2] < comb[0] + comb[1]:
        cnt += c[comb[0]] * c[comb[1]] * c[comb[2]]
    
print(cnt)

Solution (Python):

N = int(input())
L = list(map(int,input().split()))
count = 0
for i in range(N-2):
    for j in range(i+1,N):
        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[j] != L[k] and L[k]!=L[i]:
                count += 1
            else:
                pass

print(count)

Solution (Python):
N = int(input())
L = [int(l) for l in 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[k] != L[i]:
        if L[i] + L[j] > L[k] and L[k] + L[j] > L[i] and L[i] + L[k] > L[j]:
          ans += 1
          
print(ans)

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
if n<3:
    print(0)
else:
    s=set()
    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[k]!=l[i] and (i,j,k) not in s:
                    if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                        x=sorted([i,j,k])
                        s.add(tuple(x))
    
    print(len(s))

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


for i in range(2,n):
    for j in range(1,i):
        for k in range(j):
            if l[k]==l[j] or l[i]==l[j] or l[i]==l[k]:
                continue
            x=l[k]+l[j]

            if x > l[i]:
                ans+=1

print(ans)

Solution (Python):


def main():
    N = int(input())
    L = sorted(map(int, input().split()), reverse=True)
    ans = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            for k in range(j + 1, N):
                if L[i] != L[j] and L[i] != L[k] and L[j] != L[k]:
                    if L[i] < L[j] +L[k]:
                        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline


I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda: list(map(int, input().split()))

def isTriangle(a, b, c):
    if a + b > c and b + c > a and a + c > b:
        return 1
    return 0

def allDiff(a, b, c):
    if a != b and b != c and a != c:
        return 1
    return 0 

def main():
    n = I()
    arr = ARR()
    ans = 0
    for i in range(0,n-2):
        for j in range(i+1,n-1):
            for k in range(j+1,n):
                if allDiff(arr[i], arr[j], arr[k]) and isTriangle(arr[i], arr[j], arr[k]):
                    ans+=1
    
    
    print(ans)

main()

Solution (Python):
import math
import itertools

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

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

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

Solution (Python):
N = int(input())
Ls = list(map(int, input().split()))
ls = sorted(set(Ls))
ks = [Ls.count(l) for l in ls]

n = 0
for i, (l, k) in enumerate(zip(ls, ks)):
    lls = ls[i + 1:]
    kks = ks[i + 1:]
    for j, (ll, kk) in enumerate(zip(lls, kks)):
        l3s = lls[j + 1:]
        k3s = kks[j + 1:]
        for l3, k3 in zip(l3s, k3s):
            n += k * kk * k3 * (l3 < l + ll)

print(n)

Solution (Python):
import sys,collections,math,random,fractions,bisect,itertools;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]
 
n = I()
L1 = I()
df = collections.defaultdict(int)
for e in L1:
    df[e] += 1
cb = itertools.combinations(df, 3)
ans = 0
for e in cb:
    a,b,c = e
    if a + b > c and b + c > a and c + a > b:
        ans += df[a] * df[b] * df[c]
print(ans)

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

Solution (Python):
import itertools

n = int(input())
L = list(map(int, input().split()))
cnt = 0
for i, j, k in itertools.combinations(L, 3):
    if i == j or j == k or i == k:
        continue
    if i + j > k and j + k > i and k + i > j:
        cnt += 1
print(cnt)

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

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


def A(s):
  if s == 'RRR':
    return 3
  elif s == 'RRS':
    return 2
  elif s == 'RSR':
    return 1
  elif s == 'SRR':
    return 2
  elif s == 'RSS':
    return 1
  elif s == 'SRS':
    return 1
  elif s == 'SSR':
    return 1
  elif s == 'SSS':
    return 0
  l = 0
  max_l = 0
  for i in range(len(s)):
    if i == 0 and s[i] == 'R':
      l += 1
    elif s[i - 1] == s[i] and s[i] == 'R':
      l += 1
    else:
      l = 0
    if l > max_l:
      max_l = l
  return max_l


def B(N, Ls):

  def _can_tri(a, b, c):
    if a == b or a == c or b == c:
      return False
    tmp_a, tmp_b, tmp_c = sorted([a, b, c])
    if tmp_a + tmp_b > tmp_c:
      return True
    return False

  ans = 0
  for i in range(N):
    for j in range(i + 1, N):
      for k in range(j + 1, N):
        if _can_tri(Ls[i], Ls[j], Ls[k]):
          
          ans += 1
  return ans


def C():
  pass


def main():
  
  
  N = int(input())
  Ls = [int(x) for x in input().split(' ')]
  print(B(N, Ls))


if __name__ == '__main__':
  main()

Solution (Python):
N = int(input())
input_list = list(map(int, input().split()))
pair_list = []
def triangle_check(a,b,c):
    return all([a+b>c, b+c>a, c+a>b, a!=b, b!=c,c!=a])

if N < 3:
    print(0)
else:
    for i in range(N):
        for j in range(i+1,N):
            for k in range(j+1,N):
                if triangle_check(input_list[i],input_list[j],input_list[k]):
                    pair_list.append([input_list[i],input_list[j],input_list[k]])
    print(len(pair_list))

Solution (Python):
from collections import defaultdict
N = int(input())
L = defaultdict(int)
for s in input().split():
  L[int(s)] += 1
U = sorted(list(L.keys()), reverse=True)
cnt = 0
for i, a in enumerate(U):
  for j, b in enumerate(U[i+1:]):
    for c in U[i+j+2:]:
      cnt += (L[a] * L[b] * L[c]) if a < b + c else 0
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[i]+l[k]>l[j] and l[j]+l[k]>l[i] and l[i] != l[j] and l[j] != l[k] and l[i] != l[k]: 
        ans += 1
print(ans)

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

print(ans)

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

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

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

l.sort()
count = 0

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

Solution (Python):

import sys
from collections import Counter

def solve(N: int, L: "List[int]"):
    L=sorted(L)
    ans=0
    if N<3:
        print(0)
        exit()
    for i in range(N-2):
        for j in range(i+1,N-1):
            for k in range(j+1,N):
                a,b,c=L[i],L[j],L[k]
                if a==b or a==c or b==c:
                    continue
                if a < b + c and b < a + c and c < a + b:
                    ans+=1

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

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

count = 0
triangle_list = itertools.combinations(L, 3)
for triangle in triangle_list:
    if len(set(triangle)) != 3:
        continue
    a, b, c = sorted(triangle)
    if a + b > c:
        count += 1

print(count)

Solution (Python):
import itertools

def check(a, b, c):
  if not (a != b and b != c and c != a):
    return False
  if a+b>c and b+c>a and c+a>b:
    return True
  return False

n = int(input())
l = map(int, input().split())
res = 0
for a, b, c in itertools.combinations(l, 3):
  if check(a,b,c):
    res += 1

print(res)

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

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

print(count)

Solution (Python):

from bisect import *
n,*l=map(int, open(0).read().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 len({l[i],l[j],l[k]}) ==3 and l[i] + l[j] > l[k] and l[i] > l[k]- l[j]:
                ans +=1
print(ans)

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

out = 0

for i in range(n):
    for j in range(n - i - 1):
        j_i = i + j + 1
        for k in range(n - j_i - 1):
            k_i = j_i + k + 1
            L1 = L[i]
            L2 = L[j_i]
            L3 = L[k_i]
            if L1 != L2 and L2 != L3 and L3 != L1:
                M = [L1, L2, L3]
                M.sort()
                if M[2] < M[0] + M[1]:
                    
                    out += 1
print(out)

Solution (Python):
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={} 
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d


def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n=I()
        l=list(In())
        l.sort()
        ans=0
        for i in range(n):
            for j in range(i+1,n):
                for k in range(j+1,n):
                    q=0
                    if l[i]+l[j]>l[k]:
                        q+=1
                    if l[j]+l[k]>l[i]:
                        q+=1
                    if l[i]+l[k]>l[j]:
                        q+=1
                    if q==3 and (l[i]!=l[j]) and(l[j]!=l[k]) and (l[i]!=l[k]):
                        
                        ans+=1
        print(ans)
    except: 
        pass
        
M = 998244353
P = 1000000007
Inf=1000000000000000000
if __name__ == '__main__':
    
    for _ in range(1):main()

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

c=[]
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      c.append((i,j,k))
cnt=0
for i in c:
  s=l[i[0]]
  t=l[i[1]]
  u=l[i[2]]
  
  if s+t>u and t+u>s and u+s>t and len(set([s,t,u]))==3:
    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] and L[j]!=L[k] and L[k]!=L[i]:
                Max=max(L[i],L[j],L[k])
                two=L[i]+L[j]+L[k]-Max
                if Max<two:
                    ans+=1

print(ans)

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

Solution (Python):
from collections import Counter


N = int(input())

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

def judge_tri(a,b,c,dic):
    if a + b > c:
        return dic[a]*dic[b]*dic[c]
    else:
        return 0

count = Counter(L)
num_list = sorted(list(count.keys()))
num_tri = 0
if len(num_list) > 2:
    for i in range(len(num_list)-2):
        a = num_list[i]
        for j in range(i+1, len(num_list)-1):
            b= num_list[j]
            for k in range(j+1, len(num_list)):
                c = num_list[k]
                num_tri += judge_tri(a,b,c,count)
    print(num_tri)
else:
    print(0)

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

count = 0
for c_i in range(2, n):
    for b_i in range(1, c_i):
        for a_i in range(b_i):
            a, b, c = length_array[a_i], length_array[b_i], length_array[c_i]
            if a + b > c and c + a > b:
                if a != b and b != c:
                    count += 1

print(count)

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

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

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

Solution (Python):


N = int(input())

data = 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 data[i] != data[j] and data[j] != data[k] and data[k] != data[i]:
                l = [data[i],data[j],data[k]]
                ld = sorted(l, reverse = True)
                if ld[0] < ld[1]+ld[2]:
                    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] 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())
li = list(map(int, input().split()))
count = 0
if N < 2:
    print(0)
else:
    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                li2 = [li[i], li[j], li[k]]
                li2.sort()
                if (li2[2] < li2[1] + li2[0]) and (li[i] !=li[j] and li[j] != li[k] and li[i] != li[k]):
                    count += 1
    print(count)

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (n, ) = [int(e) for e in lines[0].split(' ')]
    l = [int(e) for e in lines[1].split(' ')]

    return (n, l)


def solve(n, l):

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


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
ans = 0
for i in range(len(li)-2):
  for j in range(i+1,len(li)-1):
    for k in range(j+1,len(li)):
      a = li[i]
      b = li[j]
      c = li[k]
      if a==b or b==c or c==a:
        continue
      if a+b>c and b+c>a and c+a>b:
        ans += 1
print(ans)

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

cnt = 0

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

print(cnt)

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

count = 0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if not ((l[i] == l[j]) or (l[j] == l[k]) or (l[k] == l[i])):
                temp = []
                temp.append(l[i])
                temp.append(l[j])
                temp.append(l[k])
                temp.sort()

                x = temp.pop()
                y = temp.pop()
                z = temp.pop()

                if x < y + z:
                    count += 1

print(count)

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
from itertools import combinations
LC = list(combinations(L, 3))
for l in LC:
	if l[2] < l[0] + l[1]:
		s = set(l)
		if len(s) == 3:
			ans += 1
print(ans)