Find a sequence#8699

Find a sequence

1 second
128 megabytes
Very easy

A sequence of digits from to is given. The digits are provided one per line.

Your task is to read the numbers until three consecutive digits appear for the first time that form a strictly increasing sequence with step (for example: or ).

In other words, you need to detect three consecutive numbers (a, b, c) such that:

b = a + 1,\quad c = b + 1

As soon as such a triple appears, the input process stops.

Input

Each line contains one digit: (0, 1, 2, \dots, 9).

Output

Print the number of digits read until the first occurrence of such a triple.

Examples

Example 1

Loading
Loading