import itertools
N=int(input())
L=list(map(int,input().split()))
c=0
if len(L) >=3:
    for v in itertools.combinations(L, 3):
        if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c
else:
    c=0
print(c) import itertools itertools 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 c=0 c 0 if len(L) >=3:
    for v in itertools.combinations(L, 3):
        if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c
else:
    c=0 len(L) >=3 len(L) len L 3 for v in itertools.combinations(L, 3):
        if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c v itertools.combinations(L, 3) itertools.combinations itertools combinations L 3 if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2] v[0] != v[1] and v[1] != v[2] v[0] != v[1] v[0] v 0 v[1] v 1 v[1] != v[2] v[1] v 1 v[2] v 2 v[0] != v[2] v[0] v 0 v[2] v 2 if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
         sorted(v)[-2]+min(v) > max(v) sorted(v)[-2]+min(v) sorted(v)[-2] (v) sorted v -2 min(v) min v max(v) max v c=c+1 c c+1 c 1 c=c c c c=c c c c=0 c 0 print(c) print c c=0 0 c c=c c c L=list(map(int,input().split())) list(map(int,input().split())) L c=c+1 c+1 c c=c c c N=int(input()) int(input()) N c=0 0 c
import itertools
N=int(input())
L=list(map(int,input().split()))
c=0
if len(L) >=3:
    for v in itertools.combinations(L, 3):
        if (v[0] != v[1] and v[1] != v[2]) and v[0] != v[2]:
            if sorted(v)[-2]+min(v) > max(v):
                c=c+1
            else:
                c=c
        else:
            c=c
else:
    c=0
print(c)