#K68577. Maximum Unique Purchases
Maximum Unique Purchases
Maximum Unique Purchases
In this problem, you are given several test cases. For each test case, you are provided with a list of gift card values. The task is to determine the maximum number of unique purchases that can be made, which corresponds to the number of distinct gift card values in the list.
For each test case, the first line contains an integer (n) ((n \geq 1)) representing the number of gift cards, and the second line contains (n) space-separated integers indicating the values of the gift cards. The input may contain multiple test cases. A test case starting with (n = 0) indicates the end of input and should not be processed.
Your goal is to output for each test case a single integer on a separate line representing the count of unique gift card values (i.e., the maximum number of unique purchases possible).
inputFormat
The input consists of multiple test cases. For each test case:
- The first line contains an integer (n) ((n \geq 1)).
- The next line contains (n) space-separated integers representing the gift card values. The input terminates with a test case where (n = 0), which should not be processed.
outputFormat
For each test case, output a single integer on its own line, indicating the number of unique gift card values in that test case.## sample
4
2 3 3 4
3
5 5 5
6
1 2 2 4 4 4
0
3
1
3
</p>