#K53237. Smallest Missing Positive Integer

    ID: 29487 Type: Default 1000ms 256MiB

Smallest Missing Positive Integer

Smallest Missing Positive Integer

Given an array of integers, your task is to find the smallest positive integer that does not occur in the array.

The array may contain duplicates, negative numbers, and zeros. You must find the smallest integer starting from 1 that is missing from the array.

Example: For the input array [1, 3, 6, 4, 1, 2], the answer is 5.

inputFormat

The input is provided via standard input (stdin) as a single line containing space-separated integers representing the array.

outputFormat

Output a single integer which is the smallest missing positive integer. The output should be written to standard output (stdout).

## sample
1 3 6 4 1 2
5