#C6705. Smallest Missing Positive Integer
Smallest Missing Positive Integer
Smallest Missing Positive Integer
You are given an array of integers which may include positive numbers, negatives, and zero. Your task is to find the smallest missing positive integer.
Formally, if the given array is A, you need to find the smallest integer \(k\) such that \(k > 0\) and \(k \notin A\). That is, find \(k = \min\{ x \in \mathbb{N} : x \notin A \}\).
The input is provided via standard input (stdin) and the output (the smallest missing positive integer) should be printed to standard output (stdout).
inputFormat
The first line of input contains a single integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.
outputFormat
Output a single integer, the smallest missing positive integer.
## sample6
-2 3 7 1 2 8
4
</p>