Double
InterviewTime limit1sMemory limit1024 MB
Given a sequence of positive integers, find the fewest doublings of single elements needed to make the sequence non-decreasing.
Problem
A sequence of positive integers of length is given. You want to make this sequence ascending. The sequence is ascending if holds for each ().
To make ascending, you can apply the following operation any number of times.
- Multiply by for some ().
You want to make ascending with the fewest operations. Find that minimum number of operations.
Input
The first line contains .
The second line contains .
Output
Print the answer on the first line.
Constraints
- All given numbers are integers.
- ()