import sys
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()

n = readInt()
arr = readIntList()
if len(arr) < 3:
    print("0")
    exit()
arr.sort()
count = 0
for i in range(n):
    for j in range(i+1,n):
        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]:
                count += 1
print(count) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 def input(): return sys.stdin.readline()[:-1] input mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 def readInt():return int(input()) readInt def readIntList():return list(map(int,input().split())) readIntList def readStringList():return list(input()) readStringList def readStringListWithSpace():return list(input().split()) readStringListWithSpace def readString():return input() readString n = readInt() n readInt() readInt arr = readIntList() arr readIntList() readIntList if len(arr) < 3:
    print("0")
    exit() len(arr) < 3 len(arr) len arr 3 print("0") print "0" exit() exit arr.sort() arr.sort arr sort count = 0 count 0 for i in range(n):
    for j in range(i+1,n):
        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]:
                count += 1 i range(n) range n for j in range(i+1,n):
        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]:
                count += 1 j range(i+1,n) range i+1 i 1 n if arr[i] == arr[j]:
            continue
         arr[i] == arr[j] arr[i] arr i arr[j] 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]:
                count += 1 k range(j+1,n) range j+1 j 1 n if arr[i] == arr[k] or arr[j] == arr[k]:
                continue
             arr[i] == arr[k] or arr[j] == arr[k] arr[i] == arr[k] arr[i] arr i arr[k] arr k arr[j] == arr[k] arr[j] arr j arr[k] arr k continue if arr[i] + arr[j] > arr[k]:
                count += 1 arr[i] + arr[j] > arr[k] arr[i] + arr[j] arr[i] arr i arr[j] arr j arr[k] arr k count += 1 count 1 print(count) print count def readStringList():return list(input()) def readStringList():return list(input()) readStringList count += 1 1 count arr = readIntList() readIntList() arr count = 0 0 count def readIntList():return list(map(int,input().split())) def readIntList():return list(map(int,input().split())) readIntList mod = 10**9 + 7 10**9 + 7 mod def readInt():return int(input()) def readInt():return int(input()) readInt def readStringListWithSpace():return list(input().split()) def readStringListWithSpace():return list(input().split()) readStringListWithSpace n = readInt() readInt() n def input(): return sys.stdin.readline()[:-1] def input(): return sys.stdin.readline()[:-1] input def readString():return input() def readString():return input() readString
import sys
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()

n = readInt()
arr = readIntList()
if len(arr) < 3:
    print("0")
    exit()
arr.sort()
count = 0
for i in range(n):
    for j in range(i+1,n):
        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]:
                count += 1
print(count)