URI Online Judge | 2682

Fault Detector

By Emilio Wuerges, UFFS BR Brazil

Time limit: 1

There is a machine, that produces an increasing sequence of numbers. That is, every number of this sequence is larger than its predecessor.

However, this machine is starting to break. When it starts, everything is OK. However, after some time, it starts producing wrong results.

Your task is, whenever the machine produces the first wrong number or if it turns off, ignore all following results and produce the next smallest valid number.

Since we are just checking the machine, we cannot turn it off. We have to wait it turn it of on its own. That is, we must keep reading numbers until the machine turns of on its own.

Input

The input consists of 0 < N < 104 lines, and ends with EOF.

Each line consists of a single integer 0 < X < 230.

Output

A single line, with a single integer Y, the solution for the problem.

Input Sample Output Sample

1
2
41
5
2
1

42