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())
arr = 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 arr[i] == arr[j] or arr[j] == arr[k] or arr[i] == arr[k]:
                continue
            if not ((arr[i] + arr[j]) > arr[k] and (arr[j] + arr[k]) > arr[i] and (arr[i] + arr[k]) > arr[j]):
                continue
            cnt += 1
print(cnt)

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

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

l.sort()

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

Solution (Python):
import sys
import itertools

if __name__ == '__main__':
    N = int(sys.stdin.readline())
    L = list(map(lambda x: int(x), sys.stdin.readline().rstrip().split()))

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

Solution (Python):
from itertools import combinations

N = int(input())
L = [int(x) for x in input().split()]

ans = 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:
        ans += 1

print(ans)

Solution (Python):
import sys
import itertools
N=int(sys.stdin.readline().strip())
L=map(int, sys.stdin.readline().split())
LL=list( itertools.combinations(L,3) )
ans=0
for a,b,c in LL:
    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):
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]:
                tmp = [L[i], L[j], L[k]]
                tmp.sort()
                if tmp[0]+tmp[1] > tmp[2]:
                    ans += 1

print(ans)

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

"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    L_lsit = list(map(int, input().split()))

    L_lsit.sort()

    answer = 0
    for i in range(N):
        for j in range(i+1, N):
            if L_lsit[i] != L_lsit[j]:
                for k in range(j+1, N):
                    if (L_lsit[j] != L_lsit[k]) and (L_lsit[i] + L_lsit[j] > L_lsit[k]):
                        answer += 1
    print(answer)


if __name__ == "__main__":
    main()

Solution (Python):
import itertools

N = 5
ARR = [4, 4, 9, 7, 5]


N = 10
ARR = [9, 4, 6, 1, 9, 6, 10, 6, 6, 8]

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

result = 0
for item in itertools.combinations(ARR, 3):
    x, y, z = item

    if x == y:
        continue
    if x == z:
        continue
    if y == z:
        continue

    if x + y > z:
        if abs(x - y) < z:
            result += 1

print(result)

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

Solution (Python):

N = int(input())
L = 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]>2*max(L[i],L[j],L[k]):
                ans += 1
print(ans)

Solution (Python):

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

print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n):
    for j in range(i, n):
        for k in range(j, n):
            if l[i] != l[j] and l[j] != l[k] and l[k] < l[i] + l[j]:
                cnt +=1
            else:
                pass
print(cnt)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array





sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    L = il()

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


if __name__ == '__main__':
    main()

Solution (Python):
n= int(input())
l_s= list(map(int, input().split()))
l_s.sort()
count=0
for a in range(len(l_s)):
	for b in range(a+1, len(l_s)):
		for c in range(b+1, len(l_s)):
			if l_s[a]==l_s[b]:
				pass
			elif l_s[b]==l_s[c]:
				pass
			else:
				if l_s[a]+l_s[b]>l_s[c]:
					count+=1

print(count)

Solution (Python):
n = int(input())
L = list(sorted(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[j] == L[k]: continue
            if L[i] + L[j] > L[k]: ans += 1
print(ans)

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

print(cnt)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


N = I()
L = LI()

L.sort()
l = list(itertools.combinations(L,3))

count = 0
for a in l:
    length = len(collections.Counter(a))
    
    if not length==3:
        continue
    
    if a[0]+a[1]>a[2] and a[1]+a[2]>a[0] and a[2]+a[0]>a[1]:
        count += 1
print(count)

Solution (Python):

def main():
    counter = 0
    n = int(input())
    l = list(map(int,input().split()))
    l.sort()
    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] or l[j]==l[k] or l[k]==l[i]:
                    continue
                if l[k] < (l[i] + l[j]):
                    
                    counter += 1

    print(counter)




if __name__ == '__main__':
    main()

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

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

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

if (N < 3):
    print(0)
    exit(0)
count = 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):
                count += 1

print(count)

Solution (Python):
from itertools import combinations_with_replacement
n=int(input())
L=list(map(int,input().split()))
A=[i for i in range(n)]

cnt=0
for a,b,c in combinations_with_replacement(A,3):
    i,j,k=sorted([L[a],L[b],L[c]])
    if i+j>k and i!=j and j!=k and k!=i:
        cnt +=1
print(cnt)

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

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



ntri=0
for i in range(N-2):
    for j in range(i+1,N-1):
        if L[i] < L[j]:
            Lij = L[i]+L[j]
            for k in range(j+1, N):
                if L[j]<L[k] and Lij>L[k]:
                    ntri+=1

print(ntri)

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


def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)


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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N, LS):
    
    
    LS.sort()
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            if LS[i] == LS[j]:
                continue
            for k in range(j + 1, N):
                if LS[j] == LS[k]:
                    continue
                if LS[i] + LS[j] > LS[k]:
                    
                    ret += 1
    return ret


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



T1 = """
5
4 4 9 7 5
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
5
"""

T2 = """
6
4 5 4 3 3 5
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
8
"""

T3 = """
10
9 4 6 1 9 6 10 6 6 8
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
39
"""

T4 = """
2
1 1
"""
TEST_T4 = """
>>> as_input(T4)
>>> main()
0
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()

Solution (Python):
import itertools

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


for pair in itertools.combinations(L, 3):
  if pair[0] == pair[1] or pair[1] == pair[2] or pair[0] == pair[2]:
    continue
  if pair[0] + pair[1] <= pair[2] or pair[1] + pair[2] <= pair[0] or pair[2] + pair[0] <= pair[1]:
    continue
  res += 1
  
print(res)

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

Solution (Python):
N=int(input())
L=input().split()
for i in range(N): L[i]=int(L[i])
L.sort()
res=0
if N<3: print(0)
else:
  for i in range(N):
    for j in range(i+1,N):
      if L[j]==L[i]: continue
      for k in range(j+1,N):
        if L[i]==L[k] or L[j]==L[k]: continue
        if L[k]<L[j]+L[i]: res+=1
  print(res)

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

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

print(ans)

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
LL = [int(n) for n in input().split(" ")]




OO = [n for n in range(N)]

import copy
import itertools

def makeCombination(candidate, n, lessFlag):
    if len(candidate) <= 0:
        return [[]]
    _candidate = [n for n in candidate]
    _candidate = sorted(_candidate)
    result = []
    if lessFlag is False:
        tmp = list(set(list(itertools.combinations(_candidate, n))))
        for t in tmp:
            result.append(list(t))
    else:
        for i in range(n):
            result += makeCombination(candidate, i + 1, False)
        result += [[]]
    return result

def triangle(ll):
    lll = copy.deepcopy(ll)

    maxlen = max(lll)

    lll.remove(maxlen)

    if lll[0] + lll[1] > maxlen:
        return True
    return False

ok = 0
candidates = makeCombination(OO, 3, False)
for cand in candidates:
    a = LL[cand[0]]
    b = LL[cand[1]]
    c = LL[cand[2]]
    if a != b and b != c and a != c:
        if triangle([a, b, c]):
            ok += 1
print(ok)

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


def isTriangle(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 True
        else:
            return False
    else:
        return False


cnt = 0
for i in itertools.combinations(l, 3):
    if(isTriangle(i[0], i[1], i[2])):
        cnt += 1
print(cnt)

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

Solution (Python):
import itertools
n = int(input())
L = list(map(int,input().split()))
L.sort()
answer=0
for ls in itertools.combinations(L, 3):
    if (ls[0]+ls[1]>ls[2]) and (ls[0]!=ls[1]and ls[1]!=ls[2]):
        answer +=1
print(answer)

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

Solution (Python):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    L = LI()
    cnt = 0
    for b in itertools.combinations(L,3):
        a = sorted(b)
        if a[0] < a[1] < a[2] and a[0] + a[1] > a[2]:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

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

lis.sort()


ans = 0

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

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

Solution (Python):
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


n = int(data())
arr = L()
answer = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        if arr[i] == arr[j]:
            continue
        for k in range(j+1, n):
            if arr[i] == arr[k] or arr[j] == arr[k]:
                continue
            if (arr[i] + arr[j] > arr[k]) and (arr[i] + arr[k] > arr[j]) and (arr[j] + arr[k] > arr[i]):
                answer += 1
out(answer)

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, b, c = L[i], L[j], 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):





import itertools

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


def is_triangle(a, b, c):
    return a + b > c and a + c > b and c + b > a

res = 0
for a, b, c in itertools.combinations(l, 3):
    if is_triangle(a, b, c) and a != b and b != c and c != a:
       res += 1

print(res)

Solution (Python):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	l = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	for i in range(n):
		for j in range(i, n):
			for k in range(j, n):
				if l[i] != l[j] and l[i] != l[k] and l[j] != l[k]:
					a = sorted([l[i], l[j], l[k]])
					log.print(a)
					if (a[0] + a[1] <= a[2]):
						continue
					cnt += 1
	print(cnt)
	


main()

Solution (Python):


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

answer = 0
for i in range(N):
  Li = L[i]
  if N-i < 3:
    break
  for j in range(i+1,N):
    Lj = L[j]
    if N-j < 2:
      break
    if Li==Lj:
      continue
    for k in range(j+1,N):
      Lk = L[k]
      if Lk==Li or Lk==Lj:
        continue
      if 2*max(Li,Lj,Lk)<Li+Lj+Lk:
        answer += 1

print(answer)

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

cnt = 0

for i in range(n):
    li = ls[i]
    for j in range(i+1, n):
        lj = ls[j]
        if li == lj:
            continue
        for k in range(j+1, n):
            lk = ls[k]
            if lj == lk:
                continue
            if li + lj <= lk:
                break
            cnt += 1

print(cnt)

Solution (Python):
import sys
n = int(input())
l = list(map(int, input().split()))
d = {}
set_l = list(set(l))
if len(set_l)<3:
    print(0)
    sys.exit()
for i in set_l:
    d[i] = l.count(i)
set_l.sort()
ans = 0
for i in range(len(set_l)-2):
    for j in range(i+1, len(set_l)-1):
        for k in range(j+1, len(set_l)):
            if set_l[i]+set_l[j]>set_l[k] and set_l[i]+set_l[k]>set_l[j] and set_l[k]+set_l[j]>set_l[i]:
                ans += d[set_l[i]]*d[set_l[j]]*d[set_l[k]]
print(ans)

Solution (Python):
import itertools
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i, j, k in itertools.combinations(l, 3):
	if i + j > k > abs(i-j) or j + k > i > abs(j-k) or k + i > j > abs(k-i):
		if i != j and j != k and k != i:
			ans += 1
print(ans)

Solution (Python):
n = int(input())
L = sorted([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] > L[k] and len(set([L[i], L[j], L[k]]))==3:
                ans += 1
print(ans)

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline


from itertools import combinations


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    l = tuple(geta(int))

    cnt = 0

    for c in combinations(range(n), 3):

        p, q, r = l[c[0]], l[c[1]], l[c[2]]

        if p == q or p == r or q == r:
            continue

        if abs(p - q) < r and r < p + q:
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
s=0
b=[]
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[k]!=a[i] and a[i]+a[j]>a[k] and a[i]+a[k]>a[j] and a[j]+a[k]>a[i]:
                s+=1

print(s)

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

ans = 0
for i in range(n - 2):
    for j in range(i, n - 1):
        if l[i] == l[j]:
            continue
        for k in range(j, n):
            if l[i] == l[k] or l[j] == l[k]:
                continue
            a, b, c = sorted([l[i], l[j], l[k]])
            if c - a < b:
                ans += 1
print(ans)

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 len(set({a, b, c})) == 3:
    
        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()))

ans = 0
for i in range(0,N-2) :
    for j in range(i+1,N-1) :
        for k in range(j+1,N) :
            a = [L[i],L[j],L[k]]
            a = sorted(a)
            if len(a) == len(set(a)) :
                if a[2] < a[0] + a[1] :
                    ans += 1

print(ans)

Solution (Python):
N=int(input())
Array = list(map(int, input().strip().split()))
array=list(set(Array))
array.sort()
n=len(array)
f=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for w in range(j+1,n):
            if array[i]+array[j]>array[w]:
                f+=Array.count(array[i])*Array.count(array[j])*Array.count(array[w])
print(f)

Solution (Python):
n = int(input())
sticks = list(map(int, input().split()))
cnt = 0
for i in range(0, n):
    for j in range(i+1, n):
        if sticks[i] == sticks[j]: continue

        for k in range(j + 1, n):
            if sticks[i] == sticks[k] or sticks[j] == sticks[k]: continue
            
            if sticks[i] + sticks[j] > sticks[k] and sticks[i] + sticks[k] > sticks[j] and sticks[j] + sticks[k] > sticks[i]:
                cnt+=1

print(cnt)

Solution (Python):
import sys

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

L = sorted(L)

c = 0

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

for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            li, lj, lk = L[i], L[j], L[k]
            if li == lj or lj == lk or lk == li:
                continue
            if max(li, lj, lk) < (li + lj + lk - max(li, lj, lk)):
                c += 1

print(c)

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

l.sort()

from itertools import combinations

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

print(ans)

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

print(cnt)

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

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

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

count = 0
for l1 in listL:
    for l2 in listL:
        for l3 in listL:
            if l2 > l1 and l3 > l2 and l1+l2 > l3:
                count+=1
print(count)

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

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

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

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