All problems

The Viral Coefficient

mediumPythonTime SeriesLoops

One of Meridian's drinks was picked up by a food blogger, and the owner wants to know how often the story genuinely caught fire rather than merely grew. A day catches fire if it sold at least twice what the day before it sold, and a day that lands on exactly double counts.

Task: Print how many days at least doubled on the day before them.

Input

The first line holds an integer n, always at least 2. Each of the next n lines holds one day's order count, always greater than zero.

Output

One line: a whole number between 0 and n - 1. The opening day has nothing before it and can never count. Print 0 when no day doubled.

Example:

Input:
4
5
12
20
50

Output:
2

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…