import itertools
import sys

N = int(input())
s = input().rstrip().split(' ')
L = [int(j) for j in s]

if len(L) < 3:
    print(0)
    sys.exit()

ans = 0

for i,j,k in itertools.combinations(L,3):
    if (i == j) or (i == k) or (j == k): continue
    if (i < j+k) and (j < i+k) and (k < i+j):
        ans += 1

print(ans) import itertools itertools import sys sys N = int(input()) N int(input()) int input() input s = input().rstrip().split(' ') s input().rstrip().split(' ') ().rstrip().split ().rstrip() ().rstrip () input rstrip split ' ' int(j) for j in s for j in s j s for j in s int(j) int j L = [int(j) for j in s] L [int(j) for j in s] if len(L) < 3:
    print(0)
    sys.exit() len(L) < 3 len(L) len L 3 print(0) print 0 sys.exit() sys.exit sys exit ans = 0 ans 0 for i,j,k in itertools.combinations(L,3):
    if (i == j) or (i == k) or (j == k): continue
    if (i < j+k) and (j < i+k) and (k < i+j):
        ans += 1 i j k itertools.combinations(L,3) itertools.combinations itertools combinations L 3 if (i == j) or (i == k) or (j == k): continue
     (i == j) or (i == k) or (j == k) (i == j) or (i == k) i == j i j i == k i k j == k j k if (i < j+k) and (j < i+k) and (k < i+j):
        ans += 1 (i < j+k) and (j < i+k) and (k < i+j) (i < j+k) and (j < i+k) i < j+k i j+k j k j < i+k j i+k i k k < i+j k i+j i j ans += 1 ans 1 print(ans) print ans s = input().rstrip().split(' ') input().rstrip().split(' ') s ans = 0 0 ans L = [int(j) for j in s] [int(j) for j in s] L ans += 1 1 ans N = int(input()) int(input()) N
import itertools
import sys

N = int(input())
s = input().rstrip().split(' ')
L = [int(j) for j in s]

if len(L) < 3:
    print(0)
    sys.exit()

ans = 0

for i,j,k in itertools.combinations(L,3):
    if (i == j) or (i == k) or (j == k): continue
    if (i < j+k) and (j < i+k) and (k < i+j):
        ans += 1

print(ans)