#C7780. Unique Dessert Recipes
Unique Dessert Recipes
Unique Dessert Recipes
You are given an integer n and a list of n integers representing the sweetness values of different nuts. A dessert recipe is formed by choosing any three nuts such that all three have distinct sweetness values. Two recipes are considered identical if they have the same set of sweetness values (order does not matter).
Your task is to determine the total number of unique dessert recipes that can be created.
Mathematically, if \(S\) is the set of distinct sweetness values, the answer is given by \(\binom{|S|}{3}\), where \(\binom{n}{3} = \frac{n \times (n-1) \times (n-2)}{6}\), provided \(|S| \ge 3\). Otherwise, the answer is 0.
inputFormat
The input consists of two lines:
- The first line contains an integer n, the number of nuts.
- The second line contains n space-separated integers denoting the sweetness values.
outputFormat
Output a single integer, the total number of unique dessert recipes that can be formed.
## sample5
4 8 2 6 3
10