import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations
def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r)

if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines from itertools import combinations def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r) main n, *a = map(int, read().split()) n map(int, read().split()) map int read().split() ().split () read split *a a coma = combinations(a, 3) coma combinations(a, 3) combinations a 3 r = 0 r 0 for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
     c coma if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
     sum(c) > max(c)*2 sum(c) sum c max(c)*2 max(c) max c 2 if len(set(c)) > 2:
                r += 1
     len(set(c)) > 2 len(set(c)) len set(c) set c 2 r += 1 r 1 print(r) print r if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main read = sys.stdin.read sys.stdin.read read readlines = sys.stdin.readlines sys.stdin.readlines readlines def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r) def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r) main
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations
def main():
    n, *a = map(int, read().split())
    coma = combinations(a, 3)
    r = 0
    for c in coma:
        if sum(c) > max(c)*2:
            if len(set(c)) > 2:
                r += 1
    print(r)

if __name__ == '__main__':
    main()
