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

# n = 1 or 2
if n == 1 or n == 2:
  print(0)
  exit()

# n >= 3
len_count = {}
for l in length:
  if l not in len_count:
    len_count[l] = 1
  else:
    len_count[l] += 1

uniq_len = sorted(list(set(length)))
n_len = len(uniq_len)
triangle = []

from itertools import combinations
for c in combinations(uniq_len,3):
  c = sorted(list(c))
  if c[0] + c[1] > c[2]:
    triangle.append(c)
      
ans = 0
for t in triangle:
  ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]]

print(ans) n = int(input()) n int(input()) int input() input length = list(map(int,input().split())) length list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split if n == 1 or n == 2:
  print(0)
  exit()

# n >= 3 n == 1 or n == 2 n == 1 n 1 n == 2 n 2 print(0) print 0 exit() exit len_count = {} len_count {} for l in length:
  if l not in len_count:
    len_count[l] = 1
  else:
    len_count[l] += 1 l length if l not in len_count:
    len_count[l] = 1
  else:
    len_count[l] += 1 l not in len_count l len_count len_count[l] = 1 len_count[l] len_count l 1 len_count[l] += 1 len_count[l] len_count l 1 uniq_len = sorted(list(set(length))) uniq_len sorted(list(set(length))) sorted list(set(length)) list set(length) set length n_len = len(uniq_len) n_len len(uniq_len) len uniq_len triangle = [] triangle [] from itertools import combinations for c in combinations(uniq_len,3):
  c = sorted(list(c))
  if c[0] + c[1] > c[2]:
    triangle.append(c)
       c combinations(uniq_len,3) combinations uniq_len 3 c = sorted(list(c)) c sorted(list(c)) sorted list(c) list c if c[0] + c[1] > c[2]:
    triangle.append(c)
       c[0] + c[1] > c[2] c[0] + c[1] c[0] c 0 c[1] c 1 c[2] c 2 triangle.append(c) triangle.append triangle append c ans = 0 ans 0 for t in triangle:
  ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]] t triangle ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]] ans len_count[t[0]] * len_count[t[1]] * len_count[t[2]] len_count[t[0]] * len_count[t[1]] len_count[t[0]] len_count t[0] t 0 len_count[t[1]] len_count t[1] t 1 len_count[t[2]] len_count t[2] t 2 print(ans) print ans c = sorted(list(c)) sorted(list(c)) c length = list(map(int,input().split())) list(map(int,input().split())) length len_count = {} {} len_count n = int(input()) int(input()) n ans = 0 0 ans uniq_len = sorted(list(set(length))) sorted(list(set(length))) uniq_len ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]] len_count[t[0]] * len_count[t[1]] * len_count[t[2]] ans n_len = len(uniq_len) len(uniq_len) n_len triangle = [] [] triangle
n = int(input())
length = list(map(int,input().split()))

# n = 1 or 2
if n == 1 or n == 2:
  print(0)
  exit()

# n >= 3
len_count = {}
for l in length:
  if l not in len_count:
    len_count[l] = 1
  else:
    len_count[l] += 1

uniq_len = sorted(list(set(length)))
n_len = len(uniq_len)
triangle = []

from itertools import combinations
for c in combinations(uniq_len,3):
  c = sorted(list(c))
  if c[0] + c[1] > c[2]:
    triangle.append(c)
      
ans = 0
for t in triangle:
  ans += len_count[t[0]] * len_count[t[1]] * len_count[t[2]]

print(ans)