def solve():
    N = int(input())
    L = list(map(int, input().split()))
 
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
    print(count)
 
if __name__ == "__main__":
    solve() def solve():
    N = int(input())
    L = list(map(int, input().split()))
 
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
    print(count)
  solve 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 count = 0 count 0 for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
     i range(N) range N for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
     j range(i+1, N) range i+1 i 1 N for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
     k range(j+1, N) range j+1 j 1 N if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
     L[i] != L[j] and L[j] != L[k] and L[k] != L[i] 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[k] != L[i] L[k] L k L[i] L i if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
     L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j] L[i]+L[j] > L[k] and L[j]+L[k] > L[i] L[i]+L[j] > L[k] L[i]+L[j] L[i] L i L[j] L j L[k] L k L[j]+L[k] > L[i] L[j]+L[k] L[j] L j L[k] L k L[i] L i L[k]+L[i] > L[j] L[k]+L[i] L[k] L k L[i] L i L[j] L j count += 1 count 1 print(count) print count if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def solve():
    N = int(input())
    L = list(map(int, input().split()))
 
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
    print(count)
  def solve():
    N = int(input())
    L = list(map(int, input().split()))
 
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
    print(count)
  solve
def solve():
    N = int(input())
    L = list(map(int, input().split()))
 
    count = 0
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if(L[i] != L[j] and L[j] != L[k] and L[k] != L[i]):
                    if(L[i]+L[j] > L[k] and L[j]+L[k] > L[i] and L[k]+L[i] > L[j]):
                        count += 1
 
    print(count)
 
if __name__ == "__main__":
    solve()