List
At a company that manufactures computer components, each product is assigned a sequential number. After production, every product undergoes quality control, where it is either approved for sale or marked as defective and added to a list. Occasionally, this list of defective products becomes excessively long. To manage this, consecutive numbers are condensed into a range, represented by the first and last numbers of the sequence separated by a dash. For example, instead of listing:
1,3,4,5,6,7,8,10,12,16,17,20,21,22,23,24
it is written as:
1,3-8,10,12,16-17,20-24
Write a program that takes the complete list of defective product numbers and outputs it in this condensed format.
Input
First, input the number M, which represents the total number of defective products. Then, input the defective product numbers in ascending order (1 ≤ M ≤ N ≤ 100).
Output
Output the list of defective product numbers in the shortened format on a single line. Ranges should be separated by commas, and there should be no spaces in the output.