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 sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque, defaultdict


from collections import Counter

from itertools import accumulate,combinations,permutations,product

from heapq import heapify,heappop,heappush

from functools import reduce,lru_cache

from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): 
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

def main():
    mod = 1000000007
    

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

    cnt=0
    for i in range(N-2):
        l1=A[i]
        for j in range(i+1,N-1):
            l2=A[j]
            for k in range(j+1,N):
                l3=A[k]

                if abs(l1-l2)<l3<l2+l1 and l1!=l2 and l2!=l3 and l3!=l1:
                    cnt+=1
    print(cnt)



if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



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]:
                if len(set([L[i], L[j], L[k]])) == 3:
                    ans += 1
print(ans)

Solution (Python):

am = int(input())
arr = list(map(int,input().split()))
c = 0
for i in range(am):
    for g in range(am):
        for j in range(am):
            if i!=g and g!=j and j!=i and (arr[i] != arr[g] and arr[g]!=arr[j] and arr[j]!=arr[i]):
                if arr[j] < arr[i]+arr[g] and arr[i] < arr[g]+arr[j] and arr[g] < arr[i] + arr[j]:
                    c+=1
print(c//6)

Solution (Python):

import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log,floor
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

print(ans)

Solution (Python):
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] 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:
                    count+=1
print(count)

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

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
l=lnii()
l.sort()

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

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

print(ans)

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


def main():
    n = int(input())
    L = list(map(int, input().split()))
    L.sort()
    ans = 0
    for i in range(n-2):
        for j in range(i, n-1):
            for k in range(j, n):
                if L[k] < L[j] + L[i] and len({L[i], L[j], L[k]}) == 3:
                    ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
from itertools import combinations
r=0
for a,b,c in combinations(L,3):
    if a!=b and b!=c and a!=c and 2*max(a,b,c)<a+b+c:
        r+=1
print(r)

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

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if l_s[i] == l_s[j]:
            continue
        for k in range(j + 1, n):
            if l_s[i] == l_s[k]:
                continue
            if l_s[j] == l_s[k]:
                continue
            if l_s[i] + l_s[j] > l_s[k]:
                ans += 1

print(ans)

Solution (Python):
def examA():
    S = SI()
    ans = 0
    if "R" in S:
        ans = 1
    if "RR" in S:
        ans = 2
    if "RRR" in S:
        ans = 3
    print(ans)
    return

def examB():
    N = I()
    L = LI()
    L.sort()
    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]:
                    continue
                if L[j]==L[k]:
                    continue
                if L[i]+L[j]>L[k]:
                    cnt += 1
    ans = cnt
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Solution (Python):


import os,sys
from io import BytesIO, IOBase

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


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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math



input = sys.stdin.readline
 

def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))



n=inp()
ara=inara()

ans=0

for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			s=set()
			s.add(ara[i])
			s.add(ara[j])
			s.add(ara[k])
			
			if len(s)==3:
				a=ara[i]
				b=ara[j]
				c=ara[k]
				
				if a+b>c and b+c>a and a+c>b:
					ans+=1

print(ans)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    L = read_ints()
    answer = 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] and L[i]+L[j] > L[k] and L[k]+L[j] > L[i] and L[i]+L[k] > L[j]:
                    answer += 1
    return answer


if __name__ == '__main__':
    print(solve())

Solution (Python):
import itertools
N = int(input())
L = list(map(int, input().split()))
ans = 0
for a, b, c in itertools.combinations(L, 3):
  if a+b>c and b+c>a and c+a>b and len(set([a, b, c]))==3:
    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 abs(L[i]-L[j]) < L[k] < L[i]+L[j] and L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
                ans += 1

print(ans)

Solution (Python):
from itertools import combinations

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

cnt = 0
for a,b,c in combinations(L,3):
    if a == b or b == c or c == a:
        continue
    cnt += int(max(a,b,c)*2 < a+b+c)

print(cnt)

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 len(set([L[i], L[j], L[k]])) == 3 and 2 * max([L[i], L[j], L[k]]) < sum([L[i], L[j], L[k]]):
                cnt += 1
print(cnt)

Solution (Python):
n,*l=map(int,open(0).read().split())
l.sort()
c=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]:c+=1
print(c)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 

from decimal import *



N = INT()
L = LIST()

ans = 0
for x in combinations(L, 3):
	if len(set(x)) == 3 and max(x) < sum(x)-max(x):
		ans += 1

print(ans)

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

Solution (Python):
N = int(input())
L = list(map(int,input().split()))
from itertools import combinations
Ms = list(combinations(L,3))
cnt = 0
for M in Ms:
    L1,L2,L3 = M[0],M[1],M[2]
    if L1!=L2 and L2!=L3 and L1!=L3:
        if abs(L1-L2) < L3 and L3 < L1+L2:
            cnt+=1
print(cnt)

Solution (Python):
N = int(input())
A = 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):
            a = [A[i], A[j], A[k]]
            a = sorted(a)
            if A[i] == A[j] or A[j] == A[k] or A[i] == A[k]:
                continue
            if a[0] + a[1] > a[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] != 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):
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):
            a = L[i]
            b = L[j]
            c = L[k]
            if (a != b and b != c and c != a) and (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()))
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[i] == L[k]:
                continue
            else:
                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):
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):
            A=[L[i],L[j],L[k]]
            A = sorted(A)
            if len(set(A))!=3:
                continue
            if A[0]+A[1]>A[2]:
                ans+=1
print(ans)

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

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

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

ans = 0
for a in range(N):
    La = Ls[a]
    for b in range(a+1, N):
        Lb = Ls[b]
        for c in range(b+1, N):
            Lc = Ls[c]
            if La != Lb and Lb != Lc and Lc != La:
                if La+Lb > Lc and Lb+Lc > La and Lc+La > Lb:
                    ans += 1
print(ans)

Solution (Python):
N=int(input())
L=list(map(int, input().split()))
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 L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]:
        tmp=[L[i], L[j], L[k]]
        tmp.sort(reverse=True)
        if tmp[0]<tmp[1]+tmp[2]:
          ans+=1
print(ans)

Solution (Python):
import itertools
N = int(input())
L = [int(_) for _ in input().split()]
ans = 0
for i, j, k in itertools.combinations(range(N), 3):
    a, b, c = sorted([L[i], L[j], L[k]])
    if a + b > c and a != b and b != c:
        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):
        for k in range(j):
            if L[i]==L[j] or L[j]==L[k] or L[k]==L[i]:
                continue
            if L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j]:
                cnt+=1
print(cnt)

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

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

ans = 0
for i in xrange(n):
    for j in xrange(i):
        for k in xrange(j):
            ans += a[i] > a[j] > a[k] and a[k] + a[j] > a[i]

print ans

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *L = map(int, read().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[k] != L[i]
                ):
                    ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
def is_tri(a, b, c):
    if a == b or b == c or a == c:  return 0
    ma = max(a, b, c)
    rest = a + b + c - ma
    if rest > ma:  return 1
    return 0

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

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

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

Solution (Python):
import sys
from itertools import combinations

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    L = list(map(int, input().split()))

    res = 0
    for a, b, c in combinations(L, 3):
        if a == b or b == c or c == a:
            continue
        if a + b > c and b + c > a and c + a > b:
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
N = int(input())
L = [int(_n) for _n in input().split()]
cnt = 0
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if abs(L[j]-L[k]) < L[i] < abs(L[j] + L[k]):
                cnt+=1
print(cnt)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    c = 0
    for i in range(N):
        for j in range(i):
            if A[i] == A[j]:
                continue
            for k in range(j):
                if A[k] == A[i] or A[k] == A[j]:
                    continue
                if A[j] + A[k] > A[i]:
                    c += 1

    return c

print(main())

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

nums.sort()

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

print(ans)

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

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[k] or l[j] == l[k]:
        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):
def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                    A = [L[i], L[j], L[k]]
                    A.sort()
                    if A[2] < A[0] + A[1]:
                        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import combinations


N, *L = map(int, open(0).read().split())

ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a and 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()))

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]



def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


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


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N = I()
A = IL()
ans = 0
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if not(A[i] == A[j]) and not(A[j] == A[k]) and not(A[k] == A[i]) and A[i]+A[j]>A[k] and A[k]+A[i]>A[j] and A[j]+A[k]>A[i]:
        ans += 1
print(ans)

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

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

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


A.sort()

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

Solution (Python):


from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))


def main():
	N = int(input())
	L = getlist()
	ans = 0
	for i in range(N):
		for j in range(i + 1, N):
			for k in range(j + 1, N):
				x, y, z = list(sorted([L[i], L[j], L[k]])) 
				if x != y and y != z and x + y > z:
					ans += 1

	print(ans)
	
if __name__ == '__main__':
	main()

Solution (Python):
import itertools

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

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

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

N = int(input())
A = 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):
            a, b, c = sorted([A[i], A[j], A[k]])
            if a != b and b != c and c < a + b:
                ans += 1
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=0
for x in range(n):
    for y in range(x+1,n):
        for z in range(y+1,n):
            if a[x]!=a[y] and a[y]!=a[z] and a[z]!=a[x] and a[x]+a[y]>a[z] and a[y]+a[z]>a[x] and a[z]+a[x]>a[y]:
                ans+=1
print(ans)

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

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

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

print(ans)