#K35322. Unique Teams Formation

    ID: 25506 Type: Default 1000ms 256MiB

Unique Teams Formation

Unique Teams Formation

You are given n students and a list of their skill levels. Your task is to form teams of exactly three students such that each team consists of students with distinct skill levels. Two teams are considered different if they are formed by different sets of unique skill levels.

If there are k unique skill levels, then the number of possible teams is given by the combinatorial formula:

\(\binom{k}{3} = \frac{k(k-1)(k-2)}{6}\)

If there are less than 3 unique skill levels, then it is impossible to form a valid team. Your program should compute the total number of unique teams that can be formed.

inputFormat

The input is provided via standard input (stdin) and consists of two lines:

  • The first line contains an integer n indicating the number of students.
  • The second line contains n space-separated integers representing the skill levels of the students.

outputFormat

Output a single integer to standard output (stdout): the number of unique teams that can be formed.

## sample
5
1 1 2 2 3
1