import math

n = int(input())
s = list(map(int, input().split()))
s.sort()

cnt = 0
for i in range(n-2):
    for j in range(i, n-1):
        for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1

print(cnt)
 import math math n = int(input()) n int(input()) int input() input s = list(map(int, input().split())) s list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split s.sort() s.sort s sort cnt = 0 cnt 0 for i in range(n-2):
    for j in range(i, n-1):
        for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1 i range(n-2) range n-2 n 2 for j in range(i, n-1):
        for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1 j range(i, n-1) range i n-1 n 1 for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1 k range(j, n) range j n if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1 s[i] == s[j] or s[j] == s[k] s[i] == s[j] s[i] s i s[j] s j s[j] == s[k] s[j] s j s[k] s k if s[i] + s[j] > s[k]:
                    cnt += 1 s[i] + s[j] > s[k] s[i] + s[j] s[i] s i s[j] s j s[k] s k cnt += 1 cnt 1 print(cnt) print cnt n = int(input()) int(input()) n cnt += 1 1 cnt s = list(map(int, input().split())) list(map(int, input().split())) s cnt = 0 0 cnt
import math

n = int(input())
s = list(map(int, input().split()))
s.sort()

cnt = 0
for i in range(n-2):
    for j in range(i, n-1):
        for k in range(j, n):
            if s[i] == s[j] or s[j] == s[k]:
                pass
            else:
                if s[i] + s[j] > s[k]:
                    cnt += 1

print(cnt)

