import sys

"""
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = read().rstrip().decode()
"""

N = int(input())
L = list(map(int,input().split()));
L.sort();

def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret

print(solve()) import sys sys """
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = read().rstrip().decode()
""" N = int(input()) N int(input()) int input() input L = list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L.sort() L.sort L sort def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret solve ret = 0 ret 0 for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
     i range(0,N-2) range 0 N-2 N 2 for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
     j range(i+1,N-1) range i+1 i 1 N-1 N 1 for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
     k range(j+1,N) range j+1 j 1 N if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
     L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k] L[i] != L[j] and L[j] != L[k] L[i] != L[j] L[i] L i L[j] L j L[j] != L[k] L[j] L j L[k] L k L[i]+L[j] > L[k] L[i]+L[j] L[i] L i L[j] L j L[k] L k ret += 1 ret 1 return ret ret print(solve()) print solve() solve def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret solve N = int(input()) int(input()) N L = list(map(int,input().split())) list(map(int,input().split())) L
import sys

"""
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = read().rstrip().decode()
"""

N = int(input())
L = list(map(int,input().split()));
L.sort();

def solve():
    ret = 0
    for i in range(0,N-2):
      for j in range(i+1,N-1):
        for k in range(j+1,N):
          if L[i] != L[j] and L[j] != L[k] and L[i]+L[j] > L[k]:
            ret += 1
            #print(i,j,k)
    
    return ret

print(solve())