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()))
dum = [0]*3
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
           dum[0],dum[1],dum[2] = l[i],l[j],l[k]
           dum.sort()
           if dum[2]-(dum[1]+dum[0]) < 0 and (dum[0] != dum[1] and dum[1] != dum[2] and dum[2] != dum[0]):
               cnt += 1
print(cnt)

Solution (Python):
n = int(input())
al = sorted(map(int, input().split()))

r = 0
for i in range(n-2):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if al[k] < al[j] + al[i]:
        if al[k] != al[j] and al[k] != al[i] and al[i] != al[j]:
          r += 1
print(r)

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

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



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

Solution (Python):
import numpy as np

N=int(input())

L=np.array(input().split(" "),dtype=np.int64)

cnt=0
for idx in range(N):
    for jdx in range(idx,N):
        for kdx in range(jdx,N):
            a=L[idx]
            b=L[jdx]
            c=L[kdx]
            if(a!=b and b!=c and a!=c):
                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()))
ans = 0

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

print(ans)

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

print(ans)

Solution (Python):
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


def ti(i,j,k):
    if i == j or i == k or j == k: 
        return False
    if (i+j) > k and (i+k) > j and (j+k) > i:
        return True
    return False

def solve(A):
    if len(A) < 3: return 0
    ans = 0
    for i in range(len(A)):
        for j in range(i+1, len(A)):
            for k in range(j+1, len(A)):
                if ti(A[i], A[j], A[k]):
                    ans += 1
    return ans

n = input()
A = ip()
print(solve(A))

Solution (Python):
n = int(input())
l = [int(_) for _ in input().split()]
if n < 3:
    print(0)
    exit()
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):
            a, b, c = l[i], l[j], l[k]
            if not (a == b or b == c or c == a):
                if a + b > c:
                    ans += 1
                    
print(ans)

Solution (Python):
import itertools


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

C = list(itertools.combinations(L, 3))
count = 0
for c in C:
    a, b, c = sorted(c)
    if a == b or a == c or b == c:
        continue
    if c < a + b and a < b + c and b < c + a:
        count += 1
print(count)

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

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

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

print(ans)

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

ans=0

if n<3:
  print(ans)

else:
  for x in range(0,n-2):
    for y in range(x,n-1):
      for z in range(y,n):
        if l[x]!=l[y] and l[x]!=l[z] and l[y]!=l[z]:
          if l[x]<l[y]+l[z] and l[y]<l[x]+l[z] and l[z]<l[x]+l[y]:
            ans+=1
            
  print(ans)

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

Solution (Python):

import sys,math,collections,itertools
input = sys.stdin.readline

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

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

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

Solution (Python):
import itertools
n = int(input())
c = 0
if n <= 2:
    print(0)
    exit()
li = list(map(int,input().split()))

lis = list(itertools.combinations(li,3))
for i in range(len(lis)):
    if max(lis[i]) >= (sum(lis[i])-max(lis[i])):
        c += 0
    else:
        if len(lis[i]) == len(set(lis[i])):
            c += 1
        else:
            c += 0
print(c)

Solution (Python):
import sys, math, bisect


if(__name__ == "__main__"):
    """
    N = int( input().strip() )
    Length = list( map(int, input().strip().split() ) )
    """
    N = int( input().strip() )
    Length = list( map(int, input().strip().split() ) )
    Length.sort()
    comb = 0
    if(N<3):
        print(0)
    else:
        for i in range(N-1, 1, -1):
            c = Length[i]
            for j in range(i-1, 0, -1):
                b = Length[j]
                if(c>b):
                    for k in range(j-1, -1, -1):
                        if(Length[k] < b and Length[k]+b > c):
                            comb += 1
                            
        print(comb)

Solution (Python):
if __name__ == '__main__':
    s = int(input())
    a = [int(i) for i in input().split()]
    count = 0

    for i in range(0,s-2):
        for j in range(i,s-1):
            if a[i] != a[j]:
                for k in range(j,s):
                    if a[i] != a[k] and a[j] !=a[k] and a[i]+a[j] > a[k] and a[j] +a[k] > a[i] and a[k] +a[i]>a[j]:
                        count+=1
    print(count)

Solution (Python):

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

cnt=0
for i in range(n):
    for j in range(i,n):
        for k in range(j,n):
            l1 = l[i]
            l2 = l[j]
            l3 = l[k]
            if (l1 != l2 and l2 != l3 and l1 != l3) and (l1+l2 >l3 and l2+l3 > l1 and l1+l3 > l2):
               
                cnt+=1
print(cnt)

Solution (Python):
import itertools

count = 0
x = int(input())
line = list(map(int, input().split()))
for i in itertools.combinations(line,3):
  if i[0] != i[1] and i[1] != i[2] and i[2] != i[0] and 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 sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

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

ans = 0
for K in itertools.combinations(L, 3):
    if K[0] != K[1] and K[1] != K[2] and K[2] != K[0]:
        k_sorted= sorted(K)
        
        if k_sorted[2] < k_sorted[0] + k_sorted[1]:
            ans += 1
print(ans)

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

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

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

    print(ans)
main()

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
ans=0
for x in range(n-2):
    for y in range(x+1,n-1):
        for z in range(y+1,n):
            if not (l[x]==l[y] or l[y]==l[z] or l[x]==l[z]):
                p=sorted([l[x],l[y],l[z]])
                if p[0]+p[1]>p[2]:
                    ans+=1
print(ans)

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

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

l.sort()

ans=0

import itertools
for seq in itertools.combinations(range(n),3):
    if l[seq[2]]!=l[seq[1]] and l[seq[1]]!=l[seq[0]] and l[seq[0]]!=l[seq[2]]:
        if l[seq[2]]<l[seq[0]]+l[seq[1]]:
            ans+=1  

print(ans)

Solution (Python):
import bisect
import sys
import math
from collections import deque
from heapq import heappush, heappop

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


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


def isRaw():
    return list(map(int, ssRaw()))


INF = 1 << 29

DIV = (10**9) + 7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac = fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV

    return CONV()


def cumsum(As):
    s = 0
    for a in As:
        s += a
        yield s


sys.setrecursionlimit(200005)


def dijkstra(G,start=0):
    heap = []
    cost = [INF]*len(G)
    heappush(heap,(0,start))
    while len(heap)!=0:
        c,n = heappop(heap)
        if cost[n] !=INF:
            continue
        cost[n]=c
        for e in G[n]:
            ec,v = e
            if cost[v]!=INF:
                continue
            heappush(heap,(ec+c,v))
    return cost


def main():
    n=iRaw()
    Ls = isRaw()
    ans = 0
    for l1idx in range(n):
        for l2idx in range(l1idx,n):
            for l3idx in range(l2idx,n):
                l1 = Ls[l1idx]
                l2 = Ls[l2idx]
                l3 = Ls[l3idx]
                if l1 == l2 or l2==l3 or l3==l1:
                    continue
                if l1<l2+l3 and l2 <l1+l3 and l3<l1+l2:
                    ans+=1
    print(ans)     
main()

Solution (Python):
input = raw_input

from collections import Counter
n = int(input())


c = Counter(map(int, input().split(" ")))
ls = c.keys()
n = len(ls)

out = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a, b, d = sorted([ls[i], ls[j], ls[k]])
            if a+b > d:
                out += c[ls[i]] * c[ls[j]] * c[ls[k]]

print(out)

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

import sys
from itertools import combinations


def solve(N: int, L: "List[int]"):
    l1 = list(combinations(L, 3))
    cnt = 0
    for l in l1:
        s = set(l)
        if len(s) == 3:
            M = max(l)
            if sum(l) - M > M:
                cnt += 1
    print(cnt)
    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
n = int(input())
l = list(map(int, input().split()))
cnt = 0
for t in combinations(l, 3):
    if len(set(t))==3:
        m = max(t)
        if m < sum(t)-m:
            cnt += 1
            
print(cnt)

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

Solution (Python):
n=int(input())
l=list(map(int, input().split()))
l.sort()
if n<=2:
    print(0)
    exit()
ans=0
for i in range(n):
    for j in range(i):
            for k in range(j):
                if any([i==j,j==k,k==i,l[i]==l[j],l[j]==l[k],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()))
answer = 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] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[i] < L[j] + L[k] and abs(L[j] - L[k]) < L[i]:
                answer += 1
print(answer)

Solution (Python):
import itertools

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

comb = list(itertools.combinations(L, 3))

ans = 0
for a, b, c in comb:
    if a + b > c and b + c > a and c + a > b and a != b and b != c and c != a:
        ans += 1
print(ans)

Solution (Python):
import math
import fractions
import collections
import itertools
N=int(input())
L=list(map(int,input().split()))
cnt=0
for i in range(N):
    x=L[i]
    for j in range(i+1,N):
        y=L[j]
        for k in range(j+1,N):
            z=L[k]
            if ((x+y>z)and(y+z>x)and(x+z>y))and(x!=y)and(y!=z)and(z!=x):
                cnt=cnt+1
            
print(cnt)

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

Solution (Python):

"""
Created on Sat Aug 15 21:05:46 2020

@author: NEC-PCuser
"""

N = int(input())

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

L.sort()

count = 0

for i in range(len(L)):
	for j in range(i + 1, len(L)):
		if L[i] == L[j]:
			continue
		for k in range(j + 1, len(L)):
			if L[j] == L[k]:
				continue
			if L[i] + L[j] > L[k]:
				count += 1
			else:
				break
print(count)

Solution (Python):
from sys import stdin,stdout
from collections import defaultdict
import math


n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
c=set()
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            s=(l[i],l[j],l[k])
            if len(set(s))==3 and (l[i]+l[j]>l[k]):
                ans+=1
            elif l[i]+l[j]<=l[k]:
                break
print(ans)

Solution (Python):
def solve():
    from itertools import combinations
    from collections import Counter
    n = int(input())
    s = list(map(int, input().split()))
    co = Counter(s)
    uni = set(s)
    cnt = 0
    for a, b, c in combinations(uni, 3):
        
        if not(a + b <= c or b + c <= a or c + a <= b):
            cnt += co[a] * co[b] * co[c]
    print(cnt)

solve()

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):
            t = [L[i], L[j], L[k]]
            t.sort()
            if len(set(t)) == 3 and (t[0] + t[1]) > t[2]:
                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+1, N-1):
        cnt = 0
        for k in range(j+1, N):
            if L[i] + L[j] > L[k]:
                if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                    cnt += 1
        ans += cnt

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

Solution (Python):
from itertools import combinations

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

stick = combinations(L,3)

cnt = 0
for x, y, z in stick:
    l = sorted([x, y, z])
    if x - y != 0 and x - z != 0 and y - z != 0:
        if l[2] < l[0]+l[1]:
            cnt += 1
print(cnt)

Solution (Python):
"""
    Satwik_Tiwari ;) .
    14th AUGUST , 2020  - FRIDAY
"""



from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase

from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter  
from itertools import combinations as comb 
from itertools import permutations as permutate
from bisect import bisect_left as bl


from bisect import bisect_right as br
from bisect import bisect





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


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)





from types import GeneratorType
def iterative(f, stack=[]):
  def wrapped_func(*args, **kwargs):
    if stack: return f(*args, **kwargs)
    to = f(*args, **kwargs)
    while True:
      if type(to) is GeneratorType:
        stack.append(to)
        to = next(to)
        continue
      stack.pop()
      if not stack: break
      to = stack[-1].send(to)
    return to
  return wrapped_func





mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") 
def out(var): sys.stdout.write(str(var))  
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())

def zerolist(n): return [0]*n
def nextline(): out("\n")  
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(x, y, p) :
    res = 1     
    x = x % p  
    if (x == 0) :
        return 0
    while (y > 0) :
        if ((y & 1) == 1) : 
            res = (res * x) % p

        y = y >> 1      
        x = (x * x) % p
    return res
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) :
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True



def chck(a,b,c):
    if(a+b>c and b+c>a and c+a>b):
        return True
    return False

def solve():
    n = int(inp())
    a = lis()
    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[j]!=a[k] and a[i]!=a[k]):
                    if(chck(a[i],a[j],a[k])):
                        
                        ans+=1
    print(ans)






testcase(1)

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

Solution (Python):
def isTriangle(a,b,c):
    if a==b or b==c or a==c:
        return False
    
    if a+b>c and b+c>a and a+c>b:
        return True
    else:
        return False
N = int(input())
L = list(map(int, input().split()))
ans = 0
for a in range(N-2):
    for b in range(a+1,N-1):
        for c in range(b+1,N):
            if isTriangle(L[a],L[b],L[c]):
                ans+=1
print(ans)

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
L.sort()
i=0
for a in range(len(L)):
    for b in range(a+1,len(L)):
        for c in range(b+1,len(L)):
            if L[a]==L[b] or L[a]==L[c] or L[b]==L[c]:
                continue
            if L[a]+L[b]>L[c]:
             
                i+=1

print(i)

Solution (Python):









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


ans=0
for i in range(N):
    Li=L[i]
    for j in range(i+1,N):
        Lj=L[j]
        for k in range(j+1,N):
            Lk=L[k]
            T=[Li,Lj,Lk]
            T.sort()
            if T[0]!=T[1] and T[1]!=T[2] and T[0]+T[1]>T[2]:
                ans+=1
            
print(ans)

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

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

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

main()

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


def readstr():
    return input().strip()


def readint():
    return int(input())


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


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


def main():
    N = readint()
    L = sorted(list(readnums()))
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            if L[i] == L[j]:
                continue
            for k in range(j + 1, N):
                if L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] > L[k]:
                    ans += 1

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):

import itertools

def main():
    n = int(input())
    if n < 3:
        return 0
    l_array = list(map(int, input().split()))
    ans = 0
    for (a, b, c) in itertools.combinations(l_array, 3):
        if a == b or b == c or c == a:
            continue
        elif a + b <= c or b + c <= a or c + a <= b:
            continue
        else:
            ans += 1
    return ans
        
print(main())

Solution (Python):







def solve(n,a):
  res = 0
  for i in range(n-2):
    x = a[i]
    for j in range(i+1,n-1):
      y = a[j] 
      if x == y:
        continue
      for k in range(j+1,n):
        z = a[k]
        if y == z:
          continue
        if abs(x-y) < z < x+y:
          res += 1
  return res



def main():
  N = int(input())
  a = list(sorted(map(int,input().split())))
  print(solve(N,a))
  return

if __name__ == '__main__':
  main()

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

ans = 0

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

print(ans)

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

abc = 0
def checker(a,b,c):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            return 1
        else:
            return 0
    else:
        return 0

ans = 0

for i in range(N - 2):
    for j in range(i, N - 1):
        for k in range(j, N):
            ans += checker(bou[i],bou[j],bou[k])
            
print(ans)

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
L = sorted(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[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):
N = int(input())
L = list(map(int, input().split()))

num=0
for a in range(1,N-1):
    for b in range(a+1,N):
        for c in range(b+1,N+1):
            
            if L[a-1]!=L[b-1] and L[b-1]!=L[c-1] and L[c-1]!=L[a-1] :
                if L[a-1]+L[b-1]>L[c-1] and L[b-1]+L[c-1]>L[a-1] and L[a-1]+L[c-1]>L[b-1] :
                    num+=1
print(num)

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

print(ans)