#K54837. Find Missing Numbers in a Sequence
Find Missing Numbers in a Sequence
Find Missing Numbers in a Sequence
You are given a list of positive integers. The list represents a subset of a consecutive sequence of integers. Your task is to find all the missing numbers in the complete sequence and print them in ascending order.
More formally, let \(m = \min(arr)\) and \(M = \max(arr)\). The complete sequence is \(\{m, m+1, \ldots, M\}\). You need to find the set difference between this sequence and the given list. If there are no missing numbers, output an empty line.
inputFormat
The first line contains a single integer \(n\), representing the number of elements in the list. The second line contains \(n\) space-separated positive integers.
If \(n = 0\), then the second line will be empty.
outputFormat
Output the missing numbers in a single line separated by a single space, in ascending order. If there are no missing numbers, output an empty line.
## sample4
1 2 4 6
3 5