#K55072. Next Available Ticket ID
Next Available Ticket ID
Next Available Ticket ID
Given a list of reserved ticket IDs, your task is to compute the smallest positive integer (starting from 1) that is not present in the list. This ticket ID will be used for a new reservation. For example, if the reserved ticket IDs are 1, 2, 3, and 4, the answer is 5. In another case, if the reserved IDs are not consecutive, the answer is the smallest missing integer.
Formally, find the smallest positive integer \( i \) such that \( i \notin R \), where \( R \) is the set of reserved ticket IDs.
inputFormat
The first line of input contains a single integer \( n \) representing the number of reserved tickets. The second line contains \( n \) space-separated integers representing the reserved ticket IDs. If \( n = 0 \), the second line will be empty.
outputFormat
Output a single integer representing the smallest available ticket ID that is not reserved.
## sample0
1