def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop()

def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result))

if __name__ == "__main__":
    solve() def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop() backtrack if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop() len(step) == 3 len(step) len step 3 if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
     len(set(step)) == 3 len(set(step)) len set(step) set step 3 sorted_step = sorted(step) sorted_step sorted(step) sorted step a,b,c = sorted_step a sorted_step b c if a+b > c:
                result.append(step[:])
     a+b > c a+b a b c result.append(step[:]) result.append result append step[:] step : for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop() i range(len(nums)) range len(nums) len nums step.append(nums[i]) step.append step append nums[i] nums i backtrack(nums[i+1:], step, result) backtrack nums[i+1:] nums i+1: i+1 i 1 step result step.pop() step.pop step pop nums nums step step result result def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result)) solve N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i L = [int(i) for i in input().split()] L [int(i) for i in input().split()] result = [] result [] backtrack(L, [], result) backtrack L [] result print(len(result)) print len(result) len result if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result)) def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result)) solve def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop() def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop() backtrack
def backtrack(nums, step, result):
    if len(step) == 3:
        if len(set(step)) == 3:
            sorted_step = sorted(step)
            a,b,c = sorted_step
            if a+b > c:
                result.append(step[:])
    else:
        for i in range(len(nums)):
            step.append(nums[i])
            backtrack(nums[i+1:], step, result)
            step.pop()

def solve():
    N = int(input())
    L = [int(i) for i in input().split()]
    result = []
    backtrack(L, [], result)
    print(len(result))

if __name__ == "__main__":
    solve()