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.



Sample input:
5
4 4 9 7 5


Sample output:
5

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
res = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if len(list(set([a[i], a[j], a[k]]))) < 3:
                continue
            if a[i] + a[j] <= a[k]:
                continue
            res += 1
print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
hen = []

hen = list(int(x) for x in input().split())

#print(hen)
hen_u = set(hen.sort())
#print(hen_u)
tri = 0

for a in hen_u:
    for b in hen_u:
        if(a == b):
            continue
        for c in hen_u:
            if(a == c)or(b == c):
                continue
            if(a+b >c)and(b+c >a)and(c+a >b):
                tri += 1

print(tri)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
  s=a[i]
  for j in range(i+1,len(a)):
    t=a[j]
    if len(a)<=2:
      break
    for k in range(j+1,len(a)+1):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+b-c-d
      if (mid-d)<c<mid+d:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
  s=a[i]
  for j in range(i+1,len(a)):
    t=a[j]
    if len(a)<=2:
      break
    for k in range(j+1,len(a)+1):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+b-c-d
      if (c-mid)<d and (d+mid)>c:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
  s=a[i]
  for j in range(i+1,len(a)+1):
    t=a[j]
    for k in range(j+1,len(a)+1):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+b-c-d
      if (c-mid)<d and (d+mid)>c:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
  s=a[i]
  for j in range(i+1,len(a)+1):
    t=a[j]
    for k in range(j+1,len(a)+1):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+d-c-d
      if (c-mid)<d and (d+mid)>c:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in a:
  s=a[i]
  for j in range(i+1,len(a)):
    t=a[j]
    for k in range(j+1,len(a)):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+d-c-d
      if (c-mid)<d and (d+mid)>c:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(a):
  s=a[i]
  for j in range(i+1:len(a)):
    t=a[j]
    for k in range(j+1:len(a)):
      b=a[k]
      c=max(s,t,b)
      d=min(s,t,b)
      mid=s+t+d-c-d
      if (c-d)<a and (d+mid)>c:
        count+=1
print(count)

Submission status: Runtime Error

Solution code:
n=int(input())
r=list(map(int,input().split()))
t=0
for i in range(n):
  for j in range(i+1,n):
	for k in range(j+1,n):
      s=[r[i],r[j],r[k]]
      s.sort()
      if s[0]+s[1]>s[2]:t+=1
print(t)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
for i in range(le):
    for j in range(i+1,le):
        for k in range(j+1,le):
            if (L[i] + L[j] > L[k] and
                L[i] + L[k] > L[j] and
                    L[k] + L[j] > L[i] ):
                         if (L[i] != L[j] and
                            L[i] != L[k] and
                            L[k] != L[j]):
                                score += 1

print(score)

Submission status: Runtime Error

Solution code:
n = int(input())

lst = list(input().split())

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

Submission status: Runtime Error

Solution code:

count = 0

for i in range(n-2):
  long = length[i]
  
  for j in range(i+1,n-1):
    middle = length[j]
    if middle == long:
      continue
    if middle*2 <= long :
      break
      
    for k in range(j+1,n):
      short = length[k]
      if short == middle:
        continue
      if short + middle > long:
        count += 1
      else:
        break

print(count)

Submission status: Runtime Error

Solution code:
count = 0

length = int(input())
length_list = map(int, input().split())

for i in range(length - 2):
    for j in range(i + 1, length - 1):
        if length_list[i] != length_list[j]:
            for k in range(j + 1, length):
                if length_list[j] != length_list[k] and length_list[k] != length_list[i]:
                    half_length_sum = (length_list[i] + length_list[j] + length_list[k]) / 2
                    if half_length_sum > max(length_list[i], length_list[j], length_list[k]):
                        count += 1
print(count)

Submission status: Runtime Error

Solution code:

N = input()
Ns = list(map(int, input().split()))
Ns.sort()
ans = 0

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

Submission status: Runtime Error

Solution code:

Ns = list(map(int, input().split()))
Ns.sort()
ans = 0

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
from numba import *

import sys
read = sys.stdin.buffer.read


# N = int(input())
# length = np.array(input().split(), np.int64)
length = np.array(read.split(), np.int64)[1:]


length = np.sort(length)

@njit((i8[:],), cache=True)
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
from numba import *

import sys
read = sys.stdin.buffer.read


N = int(input())
# length = np.array(input().split(), np.int64)
length = np.array(read.split(), np.int64)[1:]


length = np.sort(length)

@njit((i8[:],), cache=True)
def calc(length):
    cnt = 0
    
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                l1, l2, l3 = length[i], length[j], length[k]
                if (l1 != l2 and l1 != l3 and l2 != l3):
                    if (l1 + l2 > l3):
                        cnt += 1
    
    return (cnt)

ans = calc(length)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = int(input())
l = list(map(int,input().split()))
l.sort()

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

Submission status: Runtime Error

Solution code:
s = int(input())
l = list(map(int,input().split()))
l.sort()

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

Submission status: Runtime Error

Solution code:
s = input()
ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if k<i+j and i!=j and j!=k:
        ans +=1

Submission status: Runtime Error

Solution code:
n = int(input())
s = 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 s[i] != s[j] or s[j] != s[k] or s[k] != a[i]:
        if s[k] > abs(s[i]-s[j]) and s[k] < s[i]+s[j]:
          cnt += 1
          
print(cnt)

Submission status: Runtime Error

Solution code:
n = input()
s = 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 s[i] != s[j] and s[j] != s[k]:
        if s[k] > abs(s[i]-s[j]) and s[k] < s[i]+s[j]:
          cnt += 1
          
print(cnt)

Submission status: Runtime Error

Solution code:
n = input()
s = 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 s[i] != s[j] and s[j] != s[k]:
        if s[k] > abs(s[i]-s[j]) and s[k] < s[i]+s[j]:
          cnt += 1
          
print(cnt)

Submission status: Runtime Error

Solution code:
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 l[i] == l[j] and l[j] == l[k] and l[i] == l[k]:
        coutinue
      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)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
L_list = list(map(int,input().split()))


conter = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if a==b or b==c or c==a or a+b<=c or b+c<=a or c+a<=b:
                continue
            counter += 1


print(counter)

Submission status: Runtime Error

Solution code:
'''
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 > D2:
            continue
        cnt += 1
    print(cnt)
'''
#if,contiueの使い方による実行時間の比較用
def main():
    N, D = map(int, input().split(" "))
    xy = []
    for i in range(N):
        xy.append(list(map(int, input().split(" "))))
    D2 = D **2
    cnt = 0
    for i in range(N):
        if xy[i][0] **2 + xy[i][1] **2 <= D2:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N=int(input())
L=map(int,input().split())
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and a!=b and b!=c and c!=a:
                count=count+1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]),a!=b, b!=c, c!=a:
                count=count+1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
a!=b, b!=c, c!=a
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]):
                count=count+1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N-1,0<=b<=N-1,0<=c<=N-1,a!=b, b!=c, c!=a
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]):
                count=count+1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
                count=count+1
            else:
                continue
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N)
        for c in range(N)
        if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
            count=count+1
        else:
            continue
print(count)

Submission status: Runtime Error

Solution code:
num = input().split()
list = input().split()


import itertools
num2 = 0

for i in itertools.combinations(list, 3):
  #print(i)
  if int(i[0]) + int(i[1]) > int(i[2])  and int(i[0]) + int(i[2]) >int(i[1]) and int(i[1]) + int(i[2]) > int(i[0]) and int(i[0]) != int(i[1]) != int(i[2]):
    num += 1
print(num)

Submission status: Runtime Error

Solution code:
num1 = input().split()
list = input().split()


import itertools
num = 0

for i in itertools.combinations(list, 3):
  #print(i)
  if int(i[0]) + int(i[1]) > int(i[2])  and int(i[0]) + int(i[2]) >int(i[1]) and int(i[1]) + int(i[2]) > int(i[0]) and int(i[0]) != int(i[1]) != int(i[2]):
    num2 += 1
print(num2)

Submission status: Runtime Error

Solution code:
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(k+1,n):
      if l[i]!=l[j]!=l[k]:
        if l[i]+l[j]>l[k];
        ans+=1

print(ans)

Submission status: Runtime Error

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

l.sort()

def func(one,two,three):
  if len(set([one,two,three]))==3 and one+two>three:
    return True
  return False

ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      one=l[i]
      two=l[j]
      three0l[k]
      if func(one,two,three):
        ans+=1
        
print(ans)

Submission status: Runtime Error

Solution code:
a = int(input())
p = list(map(int,input().split()))
count = 0
 for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Submission status: Runtime Error

Solution code:
 a = int(input())
 p = list(map(int,input().split()))
 count = 0
 for i in range(a):
     for s in range(a):
         for t in range(a):
             if p[t]<p[s]<p[i] and p[t]+p[s]>p[i]:
                 count+=1
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
l = map(int,input().split())
if len(l) < 3:
  print(0)
  exit()
count = 0
l = sorted(l)
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]:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
l = map(int,input().split())
count = 0
if len(l) < 3:
  print(0)
  exit()
l = sorted(l)
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]:
        count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x,k,d = map(int, input.split())
x = abs(x)
kd = k*d

if kd<=x:
    print(x-kd)
else:
    count = x // d
    k_dash = k - count
    x -= count * d
    if k_dash % 2 == 0:
        print(x)
    else:
        print(d-x)

Submission status: Runtime Error

Solution code:
a = int(input())
b = 1
c = 2
d = ""
x = input().split()
y = 0
d = [i for i in set(x) if x.count(i) > 1]
x = list(set(x))
y = y + len(d)
print(x)
print(d)
print(y)
for i in range(len(x)):
    for j in range(len(x) - i - 1):
        if x[j] + x[j + 1] > x[j + 2] and x[j + 1] + x[j + 2] > x[j] and x[j] + x[j + 2] > x[j + 1]:
            y = y + 1
print(y)

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    L = list(map(int, input().split()))
    L = sorted(L)
    print(L)
    count = 0

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

    print(count)

if __name__ == '__main__':

Submission status: Runtime Error

Solution code:
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[i] != L[k] and L[j] != L[k] and abs(L[j]-L[k]) < L[i] and L[i] < L[j]+L[k]): t.append((L[i], L[j], L[k])):
          ans +=1
          
print(ans)

Submission status: Runtime Error

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

ans = 0
t = []
if(N >= 3):
  for i in range(N):
    for j in range(N):
      for k in range(N):
        if((abs(j-k) < a) && (a < j+k)): t.append([i, j, k])

t = list(set(t))
print(len(t))

Submission status: Runtime Error

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

cnt = 0
for i in combinations(L, 3):
    longest = max(i)
    rest = sum(i) - max(i)
    if longest < rest and i[0] != i[1] and i[0] != i[2] and i[1] != i[2] :
        cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
import itertools
 
N=int(input())
L=list(map(int,input().split()))
 
if len(L)<3:
    Lis=[]
    print(0)
elif Lis[0][0]==Lis[0][1] or Lis[0][0]==Lis[0][2] or Lis[0][1]==Lis[0][2]:
    Lis=[]
    print(0)
else:
    Lis=list(itertools.combinations(L,3))

numb=len(Lis)
count=0
 
for i in range(numb):
    if len(L)<3:
        break
 
    if Lis[i][0]==Lis[i][1] or Lis[i][0]==Lis[i][2] or Lis[i][1]==Lis[i][2]:
        pass
    else:
        bpc=Lis[i][1]+Lis[i][2]
        bmc=abs(Lis[i][1]-Lis[i][2])
        if bmc<Lis[i][0] and Lis[i][0]<bpc:
            count+=1
 
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
l = 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]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
int n;
map<int, int> store;
int createTriangles(){
	int ret = 0;
	for (int i = 0; i < n; i++){
		int t;
		cin>>t;
		if (store.count(t) == 0){
			store.insert(pii(t,1));
		}
		else{
			store.at(t)++;
		}
	}
	map<int, int>::iterator it1;
	map<int, int>::iterator it2;
	map<int, int>::iterator it3 = store.begin();
	it3++;
	it3++;
	for (it1 = store.begin(); it1 != store.end(); it1++){
		for (it2 = ++store.begin(); it2 != store.end(); it2++){
			for(it3; it3 != store.end(); it3++){
				if( it1->first + it2->first > it3->first && it1->first < it2->first && it2->first < it3->first){
					int value;
					value= it1->second*it2->second*it3->second;
					ret+=value;
				}
			}
			it3 = store.begin();
			it3++;
			it3++;
		}
	}
	cout<<ret;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >>n;
	if (n < 3){
		cout<<0;
		return 0;
	}
	createTriangles();
	return 0;
}

Submission status: Runtime Error

Solution code:
import itertools
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in itertools.combinations(arr, 3):
  if i[0]+i[1] > i[3] and i[0]+i[3] > i[1] and i[3]+i[1] > i[0]:
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
array=list(map(int,input().split()))
array1=sorted(array)
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
array=list(map(int,input().split()))
array1=array.sort()
import itertools
list1=list(itertools.combinations(array1,3))
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
array=list(map(int,input().split()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
array=list(map(int,input()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

Submission status: Runtime Error

Solution code:
n=input()
array=list(map(int,input()))
array1=array.sort()
import itertools
list1=itertools.combinations(array1,3)
ans=0
for n in range(len(list1)):
  if list[n][0]!=list[n][1] and list[n][1]!=list[n][2]:
    if list[n][0]+list[n][1]>list[n][2]:
      ans=ans+1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
l_list = list(map(int,input().split()))
l_list.sort()
count = 0
for i in range(0, n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a = list[i]
            b = list[j]
            c = list[k]
            if a == b or b == c or c == b:
                continue
            if a + b > c:
                count += 1
            else:
                break
print(count)

Submission status: Runtime Error

Solution code:
N = input()
L = list(input())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
l=[]
c=0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if (l[j]==l[k] or l[k]==l[m] or l[j]==l[m]):
        continue
      if ((l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k])):
        c += 1

print(c)

Submission status: Runtime Error

Solution code:
N=int(input())
l=[]
c=0

for i in range(N):
	a = int(input())
	l.append(a)

for j in range(N):
  	for k in range(j+1,N):
    	for m in range(k+1,N):
      		if l[j]==l[k] or l[k]==l[m] or l[j]==l[m]:
        		continue
      		if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        		c += 1

print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
c = 0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if l[j]==l[k] or l[k]==l[m] or l[j]==l[m]:
        continue
      if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        c += 1

print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
c = 0

for i in range(N):
  a = int(input())
  l.append(a)

for j in range(N):
  for k in range(j+1,N):
    for m in range(k+1,N):
      if (l[j] + l[k] > l[m]) and (l[k] + l[m] > l[j]) and (l[j] + l[m] > l[k]):
        c += 1

print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
l = []
c = 0

for i in range(1,N+1):
  a = int(input())
  l.append(a)

for j in range(1,N+1):
  for k in range(1,N+1):
    if j == k:
      continue
    for m in range(1,N+1):
      if (j == m) or (k == m):
        continue
      if (l[j] + l[k] > l[m]) or (l[j] + k[m] > l[k]) or (l[k] + l[m] > l[j]):
        c += 1

print(c)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>string to_string(pair<A, B> p);

template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {return '"' + s + '"';}

string to_string(const char* s) {return to_string((string) s);}

string to_string(bool b) {return (b ? "true" : "false");}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}

template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void test_case(vector <long> v, int n){
	sort(v.begin(),v.end());
	long ans = 0;	
	for (int i = 0; i < n - 2; i++){
		for (int j = i + 1; j < n - 1; j++){
			for (int k = j + 1; k < n; k++){
				if (v[i] != v[j] && v[j] != v[k] && v[i] != v[k] && (v[k] < v[j] + v[i] || v[i] < v[j] + v[k] || v[j] < v[k] + v[i])){
					++ans;
				}
			}                                     
		}
	}
	cout << ans;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector <long> v(n);
	for (auto &x : v){
		cin >> x;
	}
	test_case(v,n);	
    return 0;
}